From 81c4db00737f51ddb743d28464533ef16620b28a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 19 Dec 2008 08:30:26 +0000 Subject: [PATCH] Allocate SDL_AudioCVT::coeff before using it. FIXME: this is a memory leak. We don't have an SDL_FreeAudioCVT() yet. --- src/audio/SDL_audiocvt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index dc6fb0b7f..a0f7aaeda 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -1682,6 +1682,12 @@ SDL_BuildWindowedSinc(SDL_AudioCVT * cvt, SDL_AudioFormat format, } \ } + /* !!! FIXME: this memory leaks. */ + cvt->coeff = (Uint8 *) SDL_malloc((SDL_AUDIO_BITSIZE(format) / 8) * m); + if (cvt->coeff == NULL) { + return -1; + } + /* If we're using floating point, we only need to normalize */ if (SDL_AUDIO_ISFLOAT(format) && SDL_AUDIO_BITSIZE(format) == 32) { float *fDest = (float *) cvt->coeff;