public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
[parent not found: <481574461.737361433821252744.JavaMail.weblogic@epmlwas02a>]
* [LTP]  [PATCH]: Fix memory leak
@ 2015-06-08  4:00 Manjeet Pawar
  2015-06-08 16:48 ` Cyril Hrubis
  0 siblings, 1 reply; 4+ messages in thread
From: Manjeet Pawar @ 2015-06-08  4:00 UTC (permalink / raw)
  To: ltp-list@lists.sourceforge.net; +Cc: ajeet.y@samsung.com, akhilesh.k

From: Manjeet Pawar <manjeet.p@samsung.com>
Subject: [PATCH] utils/sctp/testlib/sctputil.c: Fix memory leak

This patch frees the allocated memory (used for checking peer addresses) before returning from function.

Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Manjeet Pawar <manjeet.p@samsung.com>
---
 utils/sctp/testlib/sctputil.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/utils/sctp/testlib/sctputil.c b/utils/sctp/testlib/sctputil.c
index c670af6..283b5a7 100644
--- a/utils/sctp/testlib/sctputil.c
+++ b/utils/sctp/testlib/sctputil.c
@@ -376,6 +376,7 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t *peers, int cou
 	error = sctp_getpaddrs(sk, asoc, &addrs);
 	if (-1 == error) {
 		tst_brkm(TBROK, tst_exit, "sctp_getpaddrs: %s", strerror(errno));
+		free(found);
 		return error;
 	}
 	if (error != count) {
@@ -399,6 +400,7 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t *peers, int cou
 			errno = EINVAL;
 			sctp_freepaddrs(addrs);
 			tst_brkm(TBROK, tst_exit, "sctp_getpaddrs: %s", strerror(errno));
+			free(found);
 			return -1;
 		}
 		for (j = 0; j < count; j++) {
@@ -414,5 +416,6 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t *peers, int cou
 		}
 	}
 	sctp_freepaddrs(addrs);
+	free(found);
 	return 0;
 }
-- 
1.7.1

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-09 10:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <BA.2A.27612.361B6755@epcpsbgx1.samsung.com>
2015-06-09 10:35 ` [LTP] [PATCH]: Fix memory leak Cyril Hrubis
     [not found] <481574461.737361433821252744.JavaMail.weblogic@epmlwas02a>
2015-06-09  9:00 ` Cyril Hrubis
2015-06-08  4:00 Manjeet Pawar
2015-06-08 16:48 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox