Remove useless check as data can't be NULL at this point
This commit is contained in:
parent
039273c134
commit
90c1bb4b73
@ -215,16 +215,12 @@ hashmap_insert(hashmap_t map, const char *key, const void *data, size_t len)
|
|||||||
if (!key_copy)
|
if (!key_copy)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (data) {
|
|
||||||
data_copy = safemalloc(len);
|
data_copy = safemalloc(len);
|
||||||
if (!data_copy) {
|
if (!data_copy) {
|
||||||
safefree(key_copy);
|
safefree(key_copy);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memcpy(data_copy, data, len);
|
memcpy(data_copy, data, len);
|
||||||
} else {
|
|
||||||
data_copy = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr = safemalloc(sizeof(struct hashentry_s));
|
ptr = safemalloc(sizeof(struct hashentry_s));
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user