Browse Source

Fix the realloc usage of outbuffer in WaveCallback(wavegen.c)

master
Reece H. Dunn 9 years ago
parent
commit
8e7f4e7e3d
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      src/libespeak-ng/wavegen.c

+ 4
- 3
src/libespeak-ng/wavegen.c View File

@@ -380,10 +380,11 @@ static int WaveCallback(const void *inputBuffer, void *outputBuffer,
// make a buffer 3x size of the portaudio output
ix = pa_size*3;
if (ix > outbuffer_size) {
outbuffer = (unsigned char *)realloc(outbuffer, ix);
if (outbuffer == NULL) {
unsigned char *new_outbuffer = (unsigned char *)realloc(outbuffer, ix);
if (new_outbuffer == NULL)
fprintf(stderr, "espeak: out of memory\n");
}
else
outbuffer = new_outbuffer;
outbuffer_size = ix;
out_ptr = NULL;
}

Loading…
Cancel
Save