[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Corrected some memory leacs in src/tests/run_test.c
From: |
Rui Batista |
Subject: |
[PATCH] Corrected some memory leacs in src/tests/run_test.c |
Date: |
Wed, 17 Feb 2010 00:42:24 +0000 |
Hi,
Looking more closely at me own patch I guess the first problem you
pointed out doesn't ocure because I just free the buffer when the wrf
argument is not 0. When it is the send_data call returns "" but in that
cases I didn't freed the buffer in main. Ok, this is a bit confusing and
alocating the buffer in main maybe the best opition to clear matters.
Regarding the NULL check of the alocated reply buffer in send_data
you're right.
Rui Batista
Ter, 2010-02-16 ?s 13:30 -0600, Chris Brannon escreveu:
> Rui Batista wrote:
> > In send_data a reply buffer was being alocated and never freeed, even if
> > not
> > needed. The reply buffers alocated in send_data should be freeed in main
> > too,
> > like the line buffer. This commit address also these changes.
> > ---
>
> Cool! There are a couple problems with your patch, as it stands.
> send_data can return "", AKA the empty string.
> You better not free that, because it isn't heap-allocated!
> I'd replace the return "" in send_data with this:
> reply[0] = '\0'; /* We're returning the empty string. */
>
> Next, send_data might have returned NULL, so you need to check for that
> before you use or free it.
>
> -- Chris
>
> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd
Rui Batista
E-mail/googletalk: ruiandrebatista (at) gmail (dot) com
MSN/WLM: ruiandrebatista (at) hotmail (dot) com (don't send mail to this
on)
Skype: ruiandrebatista
twitter: http://twitter.com/ragb
weblog: http://outputstream.wordpress.com
- [PATCH] Corrected some memory leacs in src/tests/run_test.c, Rui Batista, 2010/02/16
- [PATCH] Corrected some memory leacs in src/tests/run_test.c, Chris Brannon, 2010/02/16
- [PATCH] Corrected some memory leacs in src/tests/run_test.c, Rui Batista, 2010/02/16
- [PATCH] Corrected some memory leacs in src/tests/run_test.c, Rui Batista, 2010/02/16
- [PATCH] Corrected some memory leacs in src/tests/run_test.c,
Rui Batista <=
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/17
- memory allocation clarification, Luke Yelavich, 2010/02/17
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/18
- memory allocation clarification, Chris Brannon, 2010/02/19
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/20
- memory allocation clarification, Chris Brannon, 2010/02/20
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/20
- memory allocation clarification, Chris Brannon, 2010/02/22
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/22