speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Corrected some memory leacs in src/tests/run_test.c


From: Chris Brannon
Subject: [PATCH] Corrected some memory leacs in src/tests/run_test.c
Date: Tue, 16 Feb 2010 13:30:39 -0600

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]