From d6833c2db04aefb3fd972af7e723e0975fba7181 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Mon, 11 Oct 2021 15:19:09 +0300 Subject: [PATCH] fixed small memory leaks (missing XFree calls after XGetProperty/XGetWMName) --- miniglut.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/miniglut.c b/miniglut.c index c362882..6ea9b4e 100644 --- a/miniglut.c +++ b/miniglut.c @@ -715,18 +715,20 @@ static int have_netwm_fullscr(void) int fmt; long offs = 0; unsigned long i, count, rem; - Atom prop[8], type; + Atom *prop, type; Atom xa_net_supported = XInternAtom(dpy, "_NET_SUPPORTED", False); do { XGetWindowProperty(dpy, root, xa_net_supported, offs, 8, False, AnyPropertyType, - &type, &fmt, &count, &rem, (unsigned char**)prop); + &type, &fmt, &count, &rem, (unsigned char**)&prop); for(i=0; i 0); @@ -1095,9 +1097,11 @@ static Window get_daemon_window(Display *dpy) win = *(Window*)prop; XFree(prop); + wname.value = 0; if(!XGetWMName(dpy, win, &wname) || mglut_strcmp("Magellan Window", (char*)wname.value) != 0) { - return 0; + win = 0; } + XFree(wname.value); return win; } -- 1.7.10.4