]> Dogcows Code - chaz/tint2/blobdiff - src/systray/systraybar.c
fixed some segfault and memleak
[chaz/tint2] / src / systray / systraybar.c
index 41303dcc03589c119ce0caa7264b36fcb528bd6b..9f9c05d3bedbd8adcaaee7833b9e8396dbc7fb69 100644 (file)
@@ -180,7 +180,7 @@ int init_net()
                int actual_format;
                unsigned long nitems;
                unsigned long bytes_after;
-               unsigned char *prop;
+               unsigned char *prop = 0;
                int pid;
 
                _NET_WM_PID = XInternAtom(server.dsp, "_NET_WM_PID", True);
@@ -189,7 +189,7 @@ int init_net()
                int ret = XGetWindowProperty(server.dsp, win, _NET_WM_PID, 0, 1024, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop);
 
                fprintf(stderr, "tint2 : another systray is running");
-               if (ret == 0) {
+               if (ret == Success && prop) {
                        pid = prop[1] * 256;
                        pid += prop[0];
                        fprintf(stderr, " pid=%d", pid);
This page took 0.022056 seconds and 4 git commands to generate.