[lldp-devel] [PATCH] Avoid possible resource leaks

Petr Sabata contyk at redhat.com
Mon Aug 15 06:56:53 UTC 2011


This patch prevents possible resource leaks in mand_clif_cmd().

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

diff --git a/lldp_mand_cmds.c b/lldp_mand_cmds.c
index d09d6a5..264d836 100644
--- a/lldp_mand_cmds.c
+++ b/lldp_mand_cmds.c
@@ -492,8 +492,11 @@ int mand_clif_cmd(void  *data,
 
 	/* Confirm port is a lldpad managed port */
 	port = port_find_by_name(cmd.ifname);
-	if (!port)
+	if (!port) {
+		free(argvals);
+		free(args);
 		return cmd_device_not_found;
+	}
 
 	switch (cmd.cmd) {
 	case cmd_getstats:
-- 
1.7.6




More information about the lldp-devel mailing list