mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
nwfilter: Fix memory leak in virNWFilterIPAddrMapAddIPAddr
If virNWFilterHashTablePut fails, then the @val was leaked. Signed-off-by: ZhiPeng Lu <lu.zhipeng@zte.com.cn>
This commit is contained in:
parent
955caf171c
commit
7e20862576
@ -61,6 +61,8 @@ virNWFilterIPAddrMapAddIPAddr(const char *ifname, char *addr)
|
|||||||
if (!val)
|
if (!val)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
ret = virNWFilterHashTablePut(ipAddressMap, ifname, val);
|
ret = virNWFilterHashTablePut(ipAddressMap, ifname, val);
|
||||||
|
if (ret < 0)
|
||||||
|
virNWFilterVarValueFree(val);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
if (virNWFilterVarValueAddValue(val, addr) < 0)
|
if (virNWFilterVarValueAddValue(val, addr) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user