From: Cyril Hrubis <chrubis@suse.cz>
To: Manjeet Pawar <manjeet.p@samsung.com>
Cc: "ajeet.y@samsung.com" <ajeet.y@samsung.com>,
"ltp-list@lists.sourceforge.net" <ltp-list@lists.sourceforge.net>,
akhilesh.k@samsung.com
Subject: Re: [LTP] [PATCH]: Fix memory leak
Date: Mon, 8 Jun 2015 18:48:52 +0200 [thread overview]
Message-ID: <20150608164852.GA17421@rei.suse.de> (raw)
In-Reply-To: <96265675.666421433736004552.JavaMail.weblogic@epmlwas09a>
Hi!
There is also missing check for the return from malloc().
And given that we do not return the pointer to the array and that the
cound is at most 6, what about changing the malloc() to array on stack?
I.e.
- char *found = (char *) malloc(count);
- memset(found, 0, count);
+ char found[count];
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2015-06-08 16:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-08 4:00 [LTP] [PATCH]: Fix memory leak Manjeet Pawar
2015-06-08 16:48 ` Cyril Hrubis [this message]
[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=20150608164852.GA17421@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