speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH 1/2] memory leak in espeak


From: José Vilmar Estácio de Souza
Subject: [PATCH 1/2] memory leak in espeak
Date: Mon, 1 Nov 2010 16:23:41 -0200

The function module_init declares and allocates a string called info
that is only used and released if the macro ABORT is called.
This patch moves the allocation of the string to the macro abort.
---
 src/modules/espeak.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/modules/espeak.c b/src/modules/espeak.c
index 3c46cc9..ac5f374 100644
--- a/src/modules/espeak.c
+++ b/src/modules/espeak.c
@@ -230,7 +230,7 @@ module_load(void)
 }
 
 #define ABORT(msg)                                                             
\
-       g_string_append(info, msg);                                     \
+       info = g_string_new(msg);                       \
        DBG("FATAL ERROR: %s", info->str);                      \
        *status_info = info->str;                                       \
        g_string_free(info, FALSE);                                     \
@@ -249,7 +249,6 @@ module_init(char **status_info)
        if (!g_thread_supported ()) g_thread_init (NULL); 
 
        *status_info = NULL;
-       info = g_string_new("");
 
        /* Report versions. */
        espeak_version = espeak_Info(NULL);
-- 
1.7.1




reply via email to

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