Skip to contentSkip to conversation

: Fix memory leak

PATCH Cyril Hrubis 1 participant 1 message Jun 9, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 481574461.737361433821252744.JavaMail.weblogic@epmlwas02a

#1 lore raw

Hi!

Quoted 13 lines

This patch make 'found' a static array to avoid memory leaks.

---
 utils/sctp/testlib/sctputil.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
utils/sctp/testlib/sctputil.c +0 -0
index c670af6..e7333e5 100644

utils/sctp/testlib/sctputil.c int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t *peers, int cou · line 376

Quoted 9 lines
utils/sctp/testlib/sctputil.c +1 -2
@@ -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) {

I've added initialization to 0 to the else branch down below, since we removed the memset and pushed, thanks.

Signature · 8 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list