[PATCH libnl] netconf: Put nc reference in msg_parser

David Ahern dsahern at gmail.com
Wed Sep 20 18:35:04 PDT 2017


From: David Ahern <dsa at cumulusnetworks.com>

netconf_msg_parser is leaking memory. Add the put in the newly
allocated nc object to release the initial reference.

Signed-off-by: Anuradha Karuppiah <anuradhak at cumulusnetworks.com>
Signed-off-by: David Ahern <dsa at cumulusnetworks.com>
---
 lib/route/netconf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/route/netconf.c b/lib/route/netconf.c
index 0635dd7f2bcd..1d48c40e58e9 100644
--- a/lib/route/netconf.c
+++ b/lib/route/netconf.c
@@ -173,7 +173,10 @@ static int netconf_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,
 		nc->ce_mask |= NETCONF_ATTR_INPUT;
 	}
 
-	return pp->pp_cb((struct nl_object *) nc, pp);
+	err = pp->pp_cb((struct nl_object *) nc, pp);
+
+	rtnl_netconf_put(nc);
+	return err;
 }
 
 static int netconf_request_update(struct nl_cache *cache, struct nl_sock *sk)
-- 
2.13.5 (Apple Git-94)




More information about the libnl mailing list