[PATCH v2 3/3] [libx11] Cannot reach dead statement "return NULL;"

Erkki Seppälä erkki.seppala at vincit.fi
Mon Jan 31 02:03:34 PST 2011

Check for the NULLness of prop->name and prop->value instead of
name and value, which was checked earlier anyway. Decided against
using strdup due to curious memory allocation functions and the
rest of the xkb not using it either.

Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>

diff --git a/src/xkb/XKBGAlloc.c b/src/xkb/XKBGAlloc.c
index 17d13be..90ec2f9 100644
--- a/src/xkb/XKBGAlloc.c
+++ b/src/xkb/XKBGAlloc.c
@@ -696,11 +696,11 @@ register XkbPropertyPtr prop;
     prop= &geom->properties[geom->num_properties];
     prop->name= (char *)_XkbAlloc(strlen(name)+1);
-    if (!name)
+    if (!prop->name)
 	return NULL;
     prop->value= (char *)_XkbAlloc(strlen(value)+1);
-    if (!value) {
+    if (!prop->value) {
 	prop->name= NULL;
 	return NULL;

More information about the xorg-devel mailing list