Check the variable we just tried to malloc, not the string we're copying
and already checked for NULL at the beginning of the function.

Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
---
 xkb/XKBGAlloc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index 3ec9eda..f49aead 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -659,11 +659,11 @@ register XkbPropertyPtr prop;
     }
     prop= &geom->properties[geom->num_properties];
     prop->name= malloc(strlen(name)+1);
-    if (!name)
+    if (!prop->name)
        return NULL;
     strcpy(prop->name,name);
     prop->value= malloc(strlen(value)+1);
-    if (!value) {
+    if (!prop->value) {
        free(prop->name);
        prop->name= NULL;
        return NULL;
-- 
1.7.3.2

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to