speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH] Rework the do_list_voices function, and fix a memory leak.


From: William Hubbs
Subject: [PATCH] Rework the do_list_voices function, and fix a memory leak.
Date: Thu, 16 Sep 2010 15:53:25 -0500

On Thu, Sep 16, 2010 at 08:26:17PM +0000, Andrei Kholodnyi wrote:
> If you agree with this modification I can push your patch then :)
> 
> diff --git a/src/modules/module_utils.cb/src/modules/module_utils.c
> index 9fcb593..2bbcb53 100644
> --- a/src/modules/module_utils.c
> +++ b/src/modules/module_utils.c
> @@ -470,6 +470,13 @@ do_list_voices(void)
> dialect = voices[i]->dialect;
> g_string_append_printf(voice_list, "200-%s %s %s\n", voices[i]->name, lang,  
> dialect);
> }
> +
> + /* check whether we found at least one voice */
> + if (voice_list->len == 0){
> + g_string_free(voice_list, TRUE);
> + return strdup("304 CANT LIST VOICES");

strdup() can return NULL, so I'm concerned about using it this way.
What about using g_strdup?

William

> + }
> +
> g_string_append(voice_list, "200 OK VOICE LIST SENT");
> 
> DBG("Voice prepared to send to speechd");
> --

> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: 
<http://lists.freebsoft.org/pipermail/speechd/attachments/20100916/f5712dc2/attachment.pgp>


reply via email to

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