speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH 3/3] memory leaks


From: José Vilmar Estácio de Souza
Subject: [PATCH 3/3] memory leaks
Date: Mon, 8 Mar 2010 19:17:54 -0300

The _ibmtts_synth function calls  the ibmtts_next_part function to  get
the text to be synthesized, and a mark name if any. After the text
is sent to the synthesizer, the memory occupied by it is released.
However, if there was a mark name present, the memory occupied by the
text was not being released.

In the function  ibmtts_search_for_sound_icon, the memory allocated to the
string filename, was not being released correctly if the file to be
searched is not present.
---
 src/modules/ibmtts.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/modules/ibmtts.c b/src/modules/ibmtts.c
index f013643..7559f9f 100644
--- a/src/modules/ibmtts.c
+++ b/src/modules/ibmtts.c
@@ -948,6 +948,8 @@ _ibmtts_synth(void* nothing)
                 markId = (int *) xmalloc( sizeof (int) );
                 *markId = 1 + g_hash_table_size(ibmtts_index_mark_ht);
                 g_hash_table_insert(ibmtts_index_mark_ht, markId, 
strdup(*mark_name));
+                xfree(part);
+                part = NULL;
                 if (!eciInsertIndex(eciHandle, *markId)) {
                     DBG("Ibmtts: Error sending index mark to synthesizer.");
                     ibmtts_log_eci_error();
@@ -971,6 +973,8 @@ _ibmtts_synth(void* nothing)
                 if (!eciAddText(eciHandle, part)) {
                     DBG("Ibmtts: Error sending text.");
                     ibmtts_log_eci_error();
+                    xfree(part);
+                    part = NULL;
                     break;
                 }
                 xfree(part);
@@ -1570,7 +1574,7 @@ ibmtts_search_for_sound_icon(const char *icon_name)
             fn = filename->str;
     }
 */
-    g_string_free(filename, FALSE);
+    g_string_free(filename, (fn == NULL));
 #endif
     return fn;
 }
-- 
1.6.3.3


--------------000003070603010602050204--



reply via email to

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