mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
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 <shi_lei@massclouds.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
ca010e9d76
commit
f9a59e051c
@ -283,7 +283,6 @@ virNetDevIPRouteAdd(const char *ifname,
|
|||||||
virSocketAddrPtr gateway,
|
virSocketAddrPtr gateway,
|
||||||
unsigned int metric)
|
unsigned int metric)
|
||||||
{
|
{
|
||||||
struct nlmsghdr *resp = NULL;
|
|
||||||
unsigned int recvbuflen;
|
unsigned int recvbuflen;
|
||||||
unsigned int ifindex;
|
unsigned int ifindex;
|
||||||
struct rtmsg rtmsg;
|
struct rtmsg rtmsg;
|
||||||
@ -296,6 +295,7 @@ virNetDevIPRouteAdd(const char *ifname,
|
|||||||
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
|
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
|
||||||
VIR_AUTOFREE(char *) toStr = NULL;
|
VIR_AUTOFREE(char *) toStr = NULL;
|
||||||
VIR_AUTOFREE(char *) viaStr = NULL;
|
VIR_AUTOFREE(char *) viaStr = NULL;
|
||||||
|
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||||
|
|
||||||
actualAddr = addr;
|
actualAddr = addr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user