[lldp-devel] [PATCH] lldpad: Avoid possible resource leak in get_bcn()

Petr Sabata contyk at redhat.com
Mon Aug 8 13:21:17 UTC 2011


Signed-off-by: Petr Sabata <contyk at redhat.com>
---
 nltest.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/nltest.c b/nltest.c
index 2ae2212..e350ca9 100644
--- a/nltest.c
+++ b/nltest.c
@@ -781,12 +781,14 @@ static int get_bcn(char *ifname, bcn_cfg *bcn_data)
 
 	if (d->cmd != DCB_CMD_BCN_GCFG) {
 		printf("Hmm, this is not the message we were expecting.\n");
+		free(nlh);
 		return -EIO;
 	}
 	if (rta_parent->rta_type != DCB_ATTR_BCN) {
 		/* Do we really want to code up an attribute parser?? */
 		printf("A full libnetlink (with rtnl and attribute support) "
 		       "would sure be nice.\n");
+		free(nlh);
 		return -EIO;
 	}
 	rta_child = NLA_DATA(rta_parent);
-- 
1.7.6




More information about the lldp-devel mailing list