[libvirt] [PATCH] util: netdev: fix memleak of virNetDevIPRouteAdd

This patch fixes memleak for *resp* in virNetDevIPRouteAdd. Signed-off-by: Shi Lei <shi_lei@massclouds.com> --- src/util/virnetdevip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index 0f080a5..16570a5 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -283,7 +283,7 @@ virNetDevIPRouteAdd(const char *ifname, virSocketAddrPtr gateway, unsigned int metric) { - struct nlmsghdr *resp = NULL; + VIR_AUTOFREE(struct nlmsghdr *) resp = NULL; unsigned int recvbuflen; unsigned int ifindex; struct rtmsg rtmsg; -- 2.17.1

On Fri, Sep 07, 2018 at 04:27:39PM +0800, Shi Lei wrote:
This patch fixes memleak for *resp* in virNetDevIPRouteAdd.
Signed-off-by: Shi Lei <shi_lei@massclouds.com> --- src/util/virnetdevip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index 0f080a5..16570a5 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -283,7 +283,7 @@ virNetDevIPRouteAdd(const char *ifname, virSocketAddrPtr gateway, unsigned int metric) { - struct nlmsghdr *resp = NULL; + VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
I moved this to the end of the declare block so that the VIR_AUTO declarations are coupled together, reworded the commit message a bit and pushed. Reviewed-by: Erik Skultety <eskultet@redhat.com>
unsigned int recvbuflen; unsigned int ifindex; struct rtmsg rtmsg; -- 2.17.1
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 2018-09-07 at 19:35, Erik Skultety wrote:
On Fri, Sep 07, 2018 at 04:27:39PM +0800, Shi Lei wrote:
This patch fixes memleak for *resp* in virNetDevIPRouteAdd.
Signed-off-by: Shi Lei <shi_lei@massclouds.com> --- src/util/virnetdevip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index 0f080a5..16570a5 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -283,7 +283,7 @@ virNetDevIPRouteAdd(const char *ifname, virSocketAddrPtr gateway, unsigned int metric) { - struct nlmsghdr *resp = NULL; + VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
I moved this to the end of the declare block so that the VIR_AUTO declarations are coupled together, reworded the commit message a bit and pushed.
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Thanks, Shi Lei
unsigned int recvbuflen; unsigned int ifindex; struct rtmsg rtmsg; -- 2.17.1
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (2)
-
Erik Skultety
-
Shi Lei