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>
This commit is contained in:
parent
aac1b43566
commit
682865c460
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user