public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Manjeet Pawar <manjeet.p@samsung.com>
Cc: AJEET YADAV <ajeet.y@samsung.com>,
	"ltp-list@lists.sourceforge.net" <ltp-list@lists.sourceforge.net>,
	AKHILESH KUMAR <akhilesh.k@samsung.com>
Subject: Re: [LTP] [PATCH]: Fix memory leak
Date: Tue, 9 Jun 2015 11:00:41 +0200	[thread overview]
Message-ID: <20150609090041.GA24041@rei.suse.de> (raw)
In-Reply-To: <481574461.737361433821252744.JavaMail.weblogic@epmlwas02a>

Hi!
> 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>
> ---
>  utils/sctp/testlib/sctputil.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/sctp/testlib/sctputil.c b/utils/sctp/testlib/sctputil.c
> index c670af6..e7333e5 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) {

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

-- 
Cyril Hrubis
chrubis@suse.cz

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

       reply	other threads:[~2015-06-09  9:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <481574461.737361433821252744.JavaMail.weblogic@epmlwas02a>
2015-06-09  9:00 ` Cyril Hrubis [this message]
     [not found] <BA.2A.27612.361B6755@epcpsbgx1.samsung.com>
2015-06-09 10:35 ` [LTP] [PATCH]: Fix memory leak Cyril Hrubis
2015-06-08  4:00 Manjeet Pawar
2015-06-08 16:48 ` 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=20150609090041.GA24041@rei.suse.de \
    --to=chrubis@suse.cz \
    --cc=ajeet.y@samsung.com \
    --cc=akhilesh.k@samsung.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=manjeet.p@samsung.com \
    /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