aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/devdraw
diff options
context:
space:
mode:
authorXiao-Yong Jin <xjin@anl.gov>2018-03-20 22:16:17 -0500
committerDavid du Colombier <0intro@gmail.com>2018-03-27 15:03:12 +0200
commitb2f67698309b0c573cd52e357be126171be0a93a (patch)
tree1ca2ab2e5536f34063caafc022c40ddee185ba91 /src/cmd/devdraw
parent7ca1c90109e17dced4b38fbaadea9d2cf39871b7 (diff)
downloadplan9port-b2f67698309b0c573cd52e357be126171be0a93a.tar.gz
plan9port-b2f67698309b0c573cd52e357be126171be0a93a.tar.bz2
plan9port-b2f67698309b0c573cd52e357be126171be0a93a.zip
devdraw: fix some memory leaks in x11
Diffstat (limited to 'src/cmd/devdraw')
-rw-r--r--src/cmd/devdraw/x11-init.c2
-rw-r--r--src/cmd/devdraw/x11-itrans.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/devdraw/x11-init.c b/src/cmd/devdraw/x11-init.c
index 04b13a03..5363fb74 100644
--- a/src/cmd/devdraw/x11-init.c
+++ b/src/cmd/devdraw/x11-init.c
@@ -176,6 +176,7 @@ _xattach(char *label, char *winsize)
}
}
}
+ XFree(pfmt);
if(_x.chan == 0){
werrstr("could not determine screen pixel format");
goto err0;
@@ -232,6 +233,7 @@ _xattach(char *label, char *winsize)
geom = smprint("%s.geometry", label);
if(geom && XrmGetResource(database, geom, nil, &geomrestype, &geomres))
mask = XParseGeometry(geomres.addr, &x, &y, (uint*)&width, (uint*)&height);
+ XrmDestroyDatabase(database);
free(geom);
if((mask & WidthValue) && (mask & HeightValue)){
diff --git a/src/cmd/devdraw/x11-itrans.c b/src/cmd/devdraw/x11-itrans.c
index d84cdc8f..729f2647 100644
--- a/src/cmd/devdraw/x11-itrans.c
+++ b/src/cmd/devdraw/x11-itrans.c
@@ -431,8 +431,10 @@ _xgetsnarffrom(XWindow w, Atom clipboard, Atom target, int timeout0, int timeout
usleep(10*1000);
XGetWindowProperty(_x.display, _x.drawable, prop, 0, 0, 0, AnyPropertyType,
&type, &fmt, &dummy, &len, &xdata);
- if(lastlen == len && len > 0)
+ if(lastlen == len && len > 0){
+ XFree(xdata);
break;
+ }
lastlen = len;
XFree(xdata);
}