SVOX: Properly initialize buffers.
Bug: 69177126
Test: Manual / TH
Change-Id: I894ad89eb0abbc2fd8dc47ecfc897c793751ca9f
(cherry picked from commit 2258b6512256a2a2ff1a0688c9d3d43ac2df573f)
diff --git a/pico/tts/svox_ssml_parser.cpp b/pico/tts/svox_ssml_parser.cpp
index 1e86940..94cd25a 100755
--- a/pico/tts/svox_ssml_parser.cpp
+++ b/pico/tts/svox_ssml_parser.cpp
@@ -57,7 +57,12 @@
XML_SetUserData(mParser, (void*)this);
m_datasize = 512;
m_data = new char[m_datasize];
- m_data[0] = '\0';
+ if (!m_data)
+ {
+ ALOGE("Error: failed to allocate memory for string!\n");
+ } else {
+ memset(m_data, 0, m_datasize);
+ }
}
}
@@ -120,6 +125,8 @@
{
ALOGE("Error: failed to allocate memory for string!\n");
return;
+ } else {
+ memset(m_data, 0, m_datasize);
}
}