diff src/audio/SDL_audiocvt.c @ 2880:3c2f56e433a8

Allocate SDL_AudioCVT::coeff before using it. FIXME: this is a memory leak. We don't have an SDL_FreeAudioCVT() yet.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 19 Dec 2008 08:30:26 +0000
parents 3ff86c46d324
children c8d203ef4335
line wrap: on
line diff
--- a/src/audio/SDL_audiocvt.c	Fri Dec 19 06:43:41 2008 +0000
+++ b/src/audio/SDL_audiocvt.c	Fri Dec 19 08:30:26 2008 +0000
@@ -1682,6 +1682,12 @@
         } \
     }
 
+    /* !!! 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;