speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH (speechd) 3/4] Restructure spd_say, from libspeechd.c.


From: Luke Yelavich
Subject: [PATCH (speechd) 3/4] Restructure spd_say, from libspeechd.c.
Date: Wed, 24 Feb 2010 15:37:26 +1100

On Sat, Feb 20, 2010 at 02:50:11AM EST, Christopher Brannon wrote:
> spd_say leaked memory in several places.  For instance, it never
> freed strings returned by its callees escape_dot and spd_send_data_wo_mutex.
> Memory allocated by spd_execute_command_with_reply was freed in the
> normal case, but it was leaked in an error case.
> 
> I decided to split spd_say into three functions:
> spd_say, spd_say_prepare, and spd_say_sending.
> The two helper functions are static inline.
>   spd_say is much simpler, and the multiple return statements are gone.
> 
> Next, spd_say calls an auxiliary function named escape_dot.  This routine
> replaces . with .. when necessary, so that text does not cause the SSIP
> message to prematurely terminate.
> escape_dot returns NULL in exactly one situation: out-of-memory.
> The previous version of spd_say simply sent
> the unescaped text to Speech Dispatcher on a failed memory allocation.
> After this patch, spd_say fails and returns an error code when
> escape_dot fails.

Applied, thanks.

Luke



reply via email to

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