aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobias2020-04-25 20:07:28 +0000
committerWynn Wolf Arbor2020-04-26 23:56:24 +0200
commit1fd2fe716484cde85f4942921795018399b60bf4 (patch)
tree7ef69ed9840124ce86a0706293eda80d0ee57546
parent5e894ea6661cb7cf4e46977364f0ed30682418ba (diff)
downloadcwm-1fd2fe716484cde85f4942921795018399b60bf4.tar.gz
Fixed memory leak in xu_get_strprop.
If a client calls XSetTextProperty for a window to clear all its properties, then allocated memory within libX11 is not freed. OK okan@
-rw-r--r--xutil.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xutil.c b/xutil.c
index 01a7dc5..8d92b50 100644
--- a/xutil.c
+++ b/xutil.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xutil.c,v 1.112 2020/03/24 14:47:29 okan Exp $
+ * $OpenBSD: xutil.c,v 1.113 2020/04/25 20:07:28 tobias Exp $
*/
#include <sys/types.h>
@@ -73,8 +73,10 @@ xu_get_strprop(Window win, Atom atm, char **text) {
*text = NULL;
XGetTextProperty(X_Dpy, win, &prop, atm);
- if (!prop.nitems)
+ if (!prop.nitems) {
+ XFree(prop.value);
return 0;
+ }
if (Xutf8TextPropertyToTextList(X_Dpy, &prop, &list,
&nitems) == Success && nitems > 0 && *list) {