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-04-07 08:36:57 +1000 |
commit | 9c803d2fe06163157edf84ed8e0563db20ec4a73 (patch) | |
tree | 4cd973ffb91ff2ccb703b49b9a979cea2bf6260e | |
parent | 81fbb96c54f78a7cd96433294ee003c7ef6a772a (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>
(cherry picked from commit 682865c460945e1299f943561140f46439e2b4cb)
-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; |