From 690f8bffd48a4e7e74298360ddd0431dc95dcd3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erkki=20Sepp=C3=A4l=C3=A4?= Date: Tue, 18 Jan 2011 15:58:20 +0200 Subject: [PATCH] xkb: XkbPropertyPtr determined allocation success from wrong variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cannot reach dead statement "return NULL;" 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ä Reviewed-by: Alan Coopersmith --- src/xkb/XKBGAlloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xkb/XKBGAlloc.c b/src/xkb/XKBGAlloc.c index 17d13be5..90ec2f9c 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; strcpy(prop->name,name); prop->value= (char *)_XkbAlloc(strlen(value)+1); - if (!value) { + if (!prop->value) { _XkbFree(prop->name); prop->name= NULL; return NULL;