Allocate SDL_AudioCVT::coeff before using it.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 19 Dec 2008 08:30:26 +0000
changeset 28803c2f56e433a8
parent 2879 3ff86c46d324
child 2881 c8d203ef4335
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
     1.1 --- a/src/audio/SDL_audiocvt.c	Fri Dec 19 06:43:41 2008 +0000
     1.2 +++ b/src/audio/SDL_audiocvt.c	Fri Dec 19 08:30:26 2008 +0000
     1.3 @@ -1682,6 +1682,12 @@
     1.4          } \
     1.5      }
     1.6  
     1.7 +    /* !!! FIXME: this memory leaks. */
     1.8 +    cvt->coeff = (Uint8 *) SDL_malloc((SDL_AUDIO_BITSIZE(format) / 8) * m);
     1.9 +    if (cvt->coeff == NULL) {
    1.10 +        return -1;
    1.11 +    }
    1.12 +
    1.13      /* If we're using floating point, we only need to normalize */
    1.14      if (SDL_AUDIO_ISFLOAT(format) && SDL_AUDIO_BITSIZE(format) == 32) {
    1.15          float *fDest = (float *) cvt->coeff;