From 09b470c87199c2ce2f752ff03e6a2c557074e5f6 Mon Sep 17 00:00:00 2001 From: Reece Dunn Date: Thu, 1 Sep 2011 07:31:46 +0100 Subject: [PATCH] ensure that the memory allocated by espeak_ListVoices is cleaned up on exit. --- src/speak_lib.cpp | 2 ++ src/voices.cpp | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/speak_lib.cpp b/src/speak_lib.cpp index 99a1a43d..7e68ea29 100644 --- a/src/speak_lib.cpp +++ b/src/speak_lib.cpp @@ -1192,6 +1192,7 @@ ESPEAK_API espeak_ERROR espeak_Synchronize(void) extern void FreePhData(void); +extern void FreeVoiceList(void); ESPEAK_API espeak_ERROR espeak_Terminate(void) {//=========================================== @@ -1214,6 +1215,7 @@ ESPEAK_API espeak_ERROR espeak_Terminate(void) Free(outbuf); outbuf = NULL; FreePhData(); + FreeVoiceList(); if(f_logespeak) { diff --git a/src/voices.cpp b/src/voices.cpp index b5aad1d7..6d9cd78b 100644 --- a/src/voices.cpp +++ b/src/voices.cpp @@ -1744,6 +1744,18 @@ espeak_ERROR SetVoiceByProperties(espeak_VOICE *voice_selector) return(EE_OK); } // end of SetVoiceByProperties +void FreeVoiceList() +{ + for(int ix=0; ix