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:
ZhiPeng Lu 2017-09-27 16:53:50 +08:00 committed by John Ferlan
parent 955caf171c
commit 7e20862576

View File

@ -61,6 +61,8 @@ virNWFilterIPAddrMapAddIPAddr(const char *ifname, char *addr)
if (!val)
goto cleanup;
ret = virNWFilterHashTablePut(ipAddressMap, ifname, val);
if (ret < 0)
virNWFilterVarValueFree(val);
goto cleanup;
} else {
if (virNWFilterVarValueAddValue(val, addr) < 0)