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: Rui Batista
Subject: [PATCH] Corrected some memory leacs in src/tests/run_test.c
Date: Tue, 16 Feb 2010 19:50:41 +0000

You're right, please disregard this patch. What do you think of passing
the buffer to the send_data function instead of creating it there? At
least it is just the main function that have control of memory
alocations.
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




reply via email to

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