From: Shi Lei Date: Fri, 7 Sep 2018 08:27:39 +0000 (+0800) Subject: util: netdevip: Fix a memleak in virNetDevIPRouteAdd X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f9a59e051c479b7678f46ae3e70594aec605ee6a;p=libvirt.git util: netdevip: Fix a memleak in virNetDevIPRouteAdd @resp is allocated by virNetlinkCommand and the caller is responsible for freeing the buffer. Since we already converted this module to use VIR_AUTO{FREE,PTR} macros, let's resolve the problem by using them. Signed-off-by: Shi Lei Reviewed-by: Erik Skultety --- diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index 0f080a577d..103ff9edcb 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -283,7 +283,6 @@ virNetDevIPRouteAdd(const char *ifname, virSocketAddrPtr gateway, unsigned int metric) { - struct nlmsghdr *resp = NULL; unsigned int recvbuflen; unsigned int ifindex; struct rtmsg rtmsg; @@ -296,6 +295,7 @@ virNetDevIPRouteAdd(const char *ifname, VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL; VIR_AUTOFREE(char *) toStr = NULL; VIR_AUTOFREE(char *) viaStr = NULL; + VIR_AUTOFREE(struct nlmsghdr *) resp = NULL; actualAddr = addr;