From: Manjeet Pawar <manjeet.p@samsung.com>
To: "ltp-list@lists.sourceforge.net" <ltp-list@lists.sourceforge.net>
Cc: "ajeet.y@samsung.com" <ajeet.y@samsung.com>, akhilesh.k@samsung.com
Subject: [LTP] [PATCH]: Fix memory leak
Date: Mon, 08 Jun 2015 04:00:04 +0000 (GMT) [thread overview]
Message-ID: <96265675.666421433736004552.JavaMail.weblogic@epmlwas09a> (raw)
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
next reply other threads:[~2015-06-08 4:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-08 4:00 Manjeet Pawar [this message]
2015-06-08 16:48 ` [LTP] [PATCH]: Fix memory leak Cyril Hrubis
[not found] <481574461.737361433821252744.JavaMail.weblogic@epmlwas02a>
2015-06-09 9:00 ` Cyril Hrubis
[not found] <BA.2A.27612.361B6755@epcpsbgx1.samsung.com>
2015-06-09 10:35 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=96265675.666421433736004552.JavaMail.weblogic@epmlwas09a \
--to=manjeet.p@samsung.com \
--cc=ajeet.y@samsung.com \
--cc=akhilesh.k@samsung.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox