speechd-discuss
[Top][All Lists]
Advanced

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

a memory leak in ibmtts.c


From: jose vilmar estacio de souza
Subject: a memory leak in ibmtts.c
Date: Tue, 07 Sep 2010 19:14:53 -0300

Hi all.
This fix was present in opentts and I think that can be applied in 
speech-dispatcher.

Here is the patch, I don't know if I am send in the correct way.
I am send attached too.

 From e4a853f1daab7ab3f5faedd155c6cca097be6d84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Vilmar=20Est=C3=A1cio=20de=20Souza?= 
To: address@hidden
<vilmar at informal.com.br>
Date: Tue, 7 Sep 2010 19:02:49 -0300
Subject: [PATCH] memory leak in ibmtts.c

The function ibmtts_search_for_sound from ibmtts.c search for a file
  and returns a pointer to its name if it is found.
  The function does not free the string fileName in a correct way if the 
file
  is not found
---
  src/modules/ibmtts.c |   11 ++++++++++-
  1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/modules/ibmtts.c b/src/modules/ibmtts.c
index fd9871c..0c18f06 100644
--- a/src/modules/ibmtts.c
+++ b/src/modules/ibmtts.c
@@ -1589,7 +1589,16 @@ ibmtts_search_for_sound_icon(const char *icon_name)
              fn = filename->str;
      }
  */
-    g_string_free(filename, FALSE);
+
+    /*
+     * if the file was found, the pointer *fn  points to the character data
+     * of the string filename. In this situation the string filename 
must be
+     * freed but its character data must be preserved.
+     * If the file is not found, the pointer *fn contains NULL. In this
+     * situation the string filename must be freed, including its character
+     * data.
+    */
+    g_string_free(filename, (fn == NULL));
  #endif
      return fn;
  }
-- 
1.7.0.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-memory-leak.patch
Type: text/x-patch
Size: 236 bytes
Desc: not available
URL: 
<http://lists.freebsoft.org/pipermail/speechd/attachments/20100907/2def7605/attachment.bin>


reply via email to

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