From 5de96146e1a46e3f99af22332da8c1659847d0c0 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Tue, 12 Jan 2016 20:53:33 +0000 Subject: [PATCH] Fix the realloc usage of outbuf in espeak_ng_InitializeOutput(speech.c) [msvc /analyze] --- src/libespeak-ng/speech.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libespeak-ng/speech.c b/src/libespeak-ng/speech.c index 934b9874..b9f2195c 100644 --- a/src/libespeak-ng/speech.c +++ b/src/libespeak-ng/speech.c @@ -224,9 +224,11 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE buffer_length = 200; outbuf_size = (buffer_length * samplerate)/500; - outbuf = (unsigned char *)realloc(outbuf, outbuf_size); - if ((out_start = outbuf) == NULL) + out_start = (unsigned char *)realloc(outbuf, outbuf_size); + if (out_start == NULL) return ENOMEM; + else + outbuf = out_start; // allocate space for event list. Allow 200 events per second. // Add a constant to allow for very small buf_length