From: Fan Du <fan.du@windriver.com>
To: linux-sctp@vger.kernel.org
Subject: Re: [PATCH] sctp_xconnect: memory leak when malloc big buffer
Date: Mon, 14 Jan 2013 02:40:46 +0000 [thread overview]
Message-ID: <50F3702E.8090909@windriver.com> (raw)
In-Reply-To: <1357888961-1546-1-git-send-email-fan.du@windriver.com>
On 2013年01月11日 21:48, Neil Horman wrote:
> On Fri, Jan 11, 2013 at 03:22:41PM +0800, Fan Du wrote:
>> CLIENT repeatly call process_ready_sockets, which malloc without free,
>> so sctp_xconnect exit unexpectly.
>>
>> Signed-off-by: Fan Du<fan.du@windriver.com>
>> ---
>> apps/sctp_xconnect.c | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/apps/sctp_xconnect.c b/apps/sctp_xconnect.c
>> index 5874c33..4e33040 100644
>> --- a/apps/sctp_xconnect.c
>> +++ b/apps/sctp_xconnect.c
>> @@ -573,6 +573,7 @@ void process_ready_sockets(int client_socket[], int assoc_num, fd_set *rfds) {
>> }
>> }
>> }
>> + free(big_buffer);
>> }
>>
> Definately a leak, but it seems like it would be better solved by making those
> buffers static allocations. Its a single threaded app, why do all that malloc
> and free in a forever while loop when you don't really need to?
Hi, Neil
Thanks for your advice.
I have send another version to the list.
> Neil
>
>> int main(int argc, char *argv[]) {
>> --
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
--
浮沉随浪只记今朝笑
--fan
next prev parent reply other threads:[~2013-01-14 2:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 7:22 [PATCH] sctp_xconnect: memory leak when malloc big buffer Fan Du
2013-01-11 13:48 ` Neil Horman
2013-01-14 2:37 ` Fan Du
2013-01-14 2:40 ` Fan Du [this message]
2013-01-14 8:40 ` Daniel Borkmann
2013-01-14 9:45 ` Fan Du
2013-01-14 14:16 ` Neil Horman
2013-01-15 1:28 ` Fan Du
2013-01-15 12:42 ` Neil Horman
2013-01-16 1:13 ` Fan Du
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=50F3702E.8090909@windriver.com \
--to=fan.du@windriver.com \
--cc=linux-sctp@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.