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

Patrick Marchand Latifi patrick.latifi at qlogic.com
Tue Feb 19 03:19:27 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 23655b6..a9cf19c 100755
--- a/dapl/openib_cma/dapl_ib_util.c
+++ b/dapl/openib_cma/dapl_ib_util.c
@@ -121,8 +121,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