Fix a leak in map.
This commit is contained in:
parent
4a683a33fc
commit
0654f53b0f
1 changed files with 3 additions and 1 deletions
|
@ -341,8 +341,10 @@ cfw_map_set(CFWMap *map, void *key, void *obj)
|
|||
if ((bucket = malloc(sizeof(*bucket))) == NULL)
|
||||
return false;
|
||||
|
||||
if ((bucket->key = cfw_copy(key)) == NULL)
|
||||
if ((bucket->key = cfw_copy(key)) == NULL) {
|
||||
free(bucket);
|
||||
return false;
|
||||
}
|
||||
|
||||
bucket->obj = cfw_ref(obj);
|
||||
bucket->hash = cfw_hash(key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue