diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-02-13 21:36:04 -0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-02-15 10:35:43 +1000 |
commit | 682865c460945e1299f943561140f46439e2b4cb (patch) | |
tree | 9ce8beab55d77009691d16847018637ff1f44547 /xkb/XKBGAlloc.c | |
parent | aac1b435664819008989ed19f73e9c89920602c5 (diff) |
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 <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'xkb/XKBGAlloc.c')
-rw-r--r-- | xkb/XKBGAlloc.c | 4 |
1 files 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; |