From 682865c460945e1299f943561140f46439e2b4cb Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 13 Feb 2011 21:36:04 -0800 Subject: XkbAddGeomProperty: Fix checks for malloc failure 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 Signed-off-by: Peter Hutterer Reviewed-by: Daniel Stone --- xkb/XKBGAlloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index 3ec9edab8..f49aead02 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; -- cgit v1.2.3