]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/addr_parsing.c: fix realloc memory leak
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 4 Jun 2014 20:33:51 +0000 (22:33 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 4 Jun 2014 20:33:51 +0000 (22:33 +0200)
commit18c07ec5a335626b333c5146137851e1b59e6495
treebda8c0e39bface728db0da9e68605e526b0e38ce
parent5f86652663aba1d26ac45fc05527d83affea5766
common/addr_parsing.c: fix realloc memory leak

Fix handling of realloc. If realloc() fails it returns NULL, assigning
the return value of realloc() directly to the pointer without checking
for the result will lead to a memory leak in error case.

Use a temporary pointer to hold the result of realloc(). In error case
print error and exit, otherwise assign it to the pointer we want to realloc.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/common/addr_parsing.c