From: Christian Dywan Date: Mon, 19 Jul 2010 09:48:06 +0000 (+0200) Subject: Check return value of XGetWindowProperty in x11_get_address X-Git-Tag: dbus-1.4.4~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=79b4e478d7fc3890355f17d63de494b4059f30d9;p=platform%2Fupstream%2Fdbus.git Check return value of XGetWindowProperty in x11_get_address Reviewed-by: Thiago Macieira Reviewed-by: Simon McVittie Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29881 --- diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c index fe49222..0d37134 100644 --- a/tools/dbus-launch-x11.c +++ b/tools/dbus-launch-x11.c @@ -293,6 +293,7 @@ init_x_atoms (Display *display) int x11_get_address (char **paddress, pid_t *pid, long *wid) { + int result; Atom type; Window owner; int format; @@ -310,10 +311,10 @@ x11_get_address (char **paddress, pid_t *pid, long *wid) *wid = (long) owner; /* get the bus address */ - XGetWindowProperty (xdisplay, owner, address_atom, 0, 1024, False, - XA_STRING, &type, &format, &items, &after, - (unsigned char **) &data); - if (type == None || after != 0 || data == NULL || format != 8) + result = XGetWindowProperty (xdisplay, owner, address_atom, 0, 1024, False, + XA_STRING, &type, &format, &items, &after, + (unsigned char **) &data); + if (result != Success || type == None || after != 0 || data == NULL || format != 8) return FALSE; /* error */ *paddress = xstrdup (data); @@ -323,10 +324,10 @@ x11_get_address (char **paddress, pid_t *pid, long *wid) if (pid != NULL) { *pid = 0; - XGetWindowProperty (xdisplay, owner, pid_atom, 0, sizeof pid, False, - XA_CARDINAL, &type, &format, &items, &after, - (unsigned char **) &data); - if (type != None && after == 0 && data != NULL && format == 32) + result = XGetWindowProperty (xdisplay, owner, pid_atom, 0, sizeof pid, False, + XA_CARDINAL, &type, &format, &items, &after, + (unsigned char **) &data); + if (result == Success && type != None && after == 0 && data != NULL && format == 32) *pid = (pid_t) *(long*) data; XFree (data); }