Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Allocate SDL_AudioCVT::coeff before using it.
Browse files Browse the repository at this point in the history
FIXME: this is a memory leak. We don't have an SDL_FreeAudioCVT() yet.
  • Loading branch information
icculus committed Dec 19, 2008
1 parent d191fb3 commit 81c4db0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/audio/SDL_audiocvt.c
Expand Up @@ -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;
Expand Down

0 comments on commit 81c4db0

Please sign in to comment.