[ofa-general] [PATCH 3/6] [DAPL v1] fix memory leak in error path

Patrick Marchand Latifi patrick.latifi at qlogic.com
Tue Feb 19 03:17:19 PST 2008


Fix memory leak in error path.

Signed-off-by: Patrick Marchand Latifi <patrick.latifi at qlogic.com>
---

 dapl/openib_cma/dapl_ib_util.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dapl/openib_cma/dapl_ib_util.c b/dapl/openib_cma/dapl_ib_util.c
index 0606312..6b282e5 100755
--- a/dapl/openib_cma/dapl_ib_util.c
+++ b/dapl/openib_cma/dapl_ib_util.c
@@ -131,8 +131,10 @@ static int getipaddr(char *name, char *addr, int len)
 	} else {
 		if (len >= res->ai_addrlen)
 			memcpy(addr, res->ai_addr, res->ai_addrlen);
-		else
+		else {
+			freeaddrinfo(res);
 			return EINVAL;
+		}
 		
 		freeaddrinfo(res);
 	}




More information about the general mailing list