[PATCH (speechd-up)] speak_string leaks memory.

Christopher Brannon cmbrannon79 at gmail.com
Wed Feb 17 14:16:05 CET 2010


I was the person who submitted the patch that introduced this bug.
You can see it in the list archives.
The problem was that I shadowed a variable in a nested scope.
The variable pointed to allocated memory, which was never freed.
---
 speechd-up.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/speechd-up.c b/speechd-up.c
index 4dee668..1cf7aa0 100644
--- a/speechd-up.c
+++ b/speechd-up.c
@@ -421,7 +421,7 @@ speak_string(char *text)
   if (utf8_text == NULL)
     ret =  -1;
   else {
-    char *escaped_utf8_text = ssml_escape_text(utf8_text);
+    escaped_utf8_text = ssml_escape_text(utf8_text);
 
     if(escaped_utf8_text == NULL) {
       LOG(1, "No memory available to hold current string.");
-- 
1.6.6.1




More information about the Speechd mailing list