aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorManjeet Pawar <manjeet.p@samsung.com>2015-06-09 17:28:06 +0530
committerCyril Hrubis <chrubis@suse.cz>2015-06-09 10:59:07 +0200
commit7cfe1586b8ede927ef199c09544378bc442951f5 (patch)
tree100e5eb8fe879f743c1afb3917617f83cd7953c8 /utils
parentae3849b5bba599f0c5fe46bfcff7b3f25fef1c7b (diff)
sctp: sctputil.c: make 'found' a static array
This patch make 'found' a static array to avoid memory leaks. Signed-off-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Manjeet Pawar <manjeet.p@samsung.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/sctp/testlib/sctputil.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/utils/sctp/testlib/sctputil.c b/utils/sctp/testlib/sctputil.c
index c670af679..c678072b1 100644
--- a/utils/sctp/testlib/sctputil.c
+++ b/utils/sctp/testlib/sctputil.c
@@ -370,8 +370,7 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t *peers, int cou
struct sockaddr *sa_addr;
socklen_t addrs_size = 0;
void *addrbuf;
- char *found = (char *) malloc(count);
- memset(found, 0, count);
+ char found[count];
error = sctp_getpaddrs(sk, asoc, &addrs);
if (-1 == error) {
@@ -405,6 +404,8 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t *peers, int cou
if (cmp_addr((sockaddr_storage_t *)sa_addr,
&peers[j]) == 0) {
found[j] = 1;
+ } else {
+ found[j] = 0;
}
}
}