Browse Source

espeakengine: avoid leaking memory from currentLanguage.

master
Reece H. Dunn 12 years ago
parent
commit
4529991fe4
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      android/jni/jni/espeakengine.cpp

+ 3
- 3
android/jni/jni/espeakengine.cpp View File

// Callback to the TTS API // Callback to the TTS API
synthDoneCB_t *ttsSynthDoneCBPointer; synthDoneCB_t *ttsSynthDoneCBPointer;


char *currentLanguage = (char *) "en-us";
char *currentRate = (char *) "150"; char *currentRate = (char *) "150";
char *eSpeakDataPath = NULL; char *eSpeakDataPath = NULL;


char currentLanguage[33];
char currentLang[10]; char currentLang[10];
char currentCountry[10]; char currentCountry[10];
char currentVariant[10]; char currentVariant[10];
voice.variant = 0; voice.variant = 0;
espeak_SetVoiceByProperties(&voice); espeak_SetVoiceByProperties(&voice);


strcpy(currentLanguage, "en-us");
hasInitialized = true; hasInitialized = true;


return TTS_SUCCESS; return TTS_SUCCESS;
return TTS_FAILURE; return TTS_FAILURE;
} }


strcpy(currentLanguage, lang);
strcpy(currentLang, lang); strcpy(currentLang, lang);
strcpy(currentCountry, country); strcpy(currentCountry, country);
strcpy(currentVariant, variant); strcpy(currentVariant, variant);
voice.variant = 0; voice.variant = 0;
voice.languages = espeakLangStr; voice.languages = espeakLangStr;
espeak_ERROR err = espeak_SetVoiceByProperties(&voice); espeak_ERROR err = espeak_SetVoiceByProperties(&voice);
currentLanguage = new char[strlen(lang)];
strcpy(currentLanguage, lang);


if (err != EE_OK) { if (err != EE_OK) {
LOGE("Error code %d when setting voice properties!", err); LOGE("Error code %d when setting voice properties!", err);

Loading…
Cancel
Save