fixed some segfault and memleak

git-svn-id: http://tint2.googlecode.com/svn/trunk@195 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr
2009-09-25 19:11:50 +00:00
parent f81e1b2e90
commit 7b570efb8f
4 changed files with 26 additions and 11 deletions

View 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);