[PATCH 3/4] XkbAddGeomProperty: Fix checks for malloc failure
Alan Coopersmith
alan.coopersmith at oracle.com
Sun Feb 13 21:36:04 PST 2011
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.coopersmith at 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
More information about the xorg-devel
mailing list