"components/platform/include/flash_api.h" did not exist on "0420b6d72f0bf8eae78ccca3e57ac5014cc4bc88"
Unverified Commit ccb76e56 authored by Binbin's avatar Binbin Committed by GitHub
Browse files

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: default avatarOran Agra <oran@redislabs.com>
parent 5100ef9f
...@@ -269,9 +269,14 @@ list *listDup(list *orig) ...@@ -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;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment