MINOR: new function my_realloc2 = realloc + free upon failure
authorHubert Verstraete <hubs@users.sourceforge.net>
Tue, 28 Jun 2016 20:41:00 +0000 (22:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 29 Jun 2016 08:45:15 +0000 (10:45 +0200)
commit2eae3a0497f01960dd7f4ffc638f11fc36aa5991
tree6f4e9a7c4ea39e3ea4e1bc65bf72c85ca1389b41
parenta9300a3d5a068c6e6c0a95f2a2640df557aa0a4c
MINOR: new function my_realloc2 = realloc + free upon failure

When realloc fails to allocate memory, the original pointer is not
freed. Sometime people override the original pointer with the pointer
returned by realloc which is NULL in case of failure. This results
in a memory leak because the memory pointed by the original pointer
cannot be freed.
include/common/standard.h