Free value if dup succeed but listAddNodeTail failed. (#8901)
This fix is in dead code. see redisOutOfMemoryHandler an allocation can't fail. but maybe someone will copy this code to a different project some day, better have this fixed Co-authored-by: Oran Agra <oran@redislabs.com>
This commit is contained in:
parent
5100ef9f82
commit
ccb76e5688
|
@ -269,9 +269,14 @@ list *listDup(list *orig)
|
||||||
listRelease(copy);
|
listRelease(copy);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
value = node->value;
|
value = node->value;
|
||||||
|
}
|
||||||
|
|
||||||
if (listAddNodeTail(copy, value) == NULL) {
|
if (listAddNodeTail(copy, value) == NULL) {
|
||||||
|
/* Free value if dup succeed but listAddNodeTail failed. */
|
||||||
|
if (copy->free) copy->free(value);
|
||||||
|
|
||||||
listRelease(copy);
|
listRelease(copy);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue