Subject: [iproute2 PATCH 05/11] Fix memory leak of lname variable in get_target_name()

From: Thomas Jarosch <[email-masked]>
Date: Mon, 03 Oct 2011 17:23:30 +0200

Detected by cppcheck.

Signed-off-by: Thomas Jarosch <[email-masked]>
---
 tc/m_ipt.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tc/m_ipt.c b/tc/m_ipt.c
index 99d9965..a73d400 100644
--- a/tc/m_ipt.c
+++ b/tc/m_ipt.c
@@ -281,6 +281,7 @@ get_target_name(const char *name)
 			fputs(dlerror(), stderr);
 			printf("\n");
 			free(new_name);
+			free(lname);
 			return NULL;
 		}
 	}
@@ -297,6 +298,7 @@ get_target_name(const char *name)
 					fprintf(stderr, "\n");
 					dlclose(handle);
 					free(new_name);
+					free(lname);
 					return NULL;
 				}
 			}
@@ -304,6 +306,7 @@ get_target_name(const char *name)
 	}
 
 	free(new_name);
+	free(lname);
 	return m;
 }
 
-- 
1.7.4.4