Skip to content

Commit

Permalink
Initialize an allocated buffer, in case conversion doesn't completely…
Browse files Browse the repository at this point in the history
… fill it.

Fixes popping noises that happen sometimes at the end of playback.

Thanks to Vern Jensen for the fix!
  • Loading branch information
icculus committed Sep 2, 2011
1 parent 15f1003 commit 1312544
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mixer.c
Expand Up @@ -631,7 +631,7 @@ Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc)
}
samplesize = ((wavespec.format & 0xFF)/8)*wavespec.channels;
wavecvt.len = chunk->alen & ~(samplesize-1);
wavecvt.buf = (Uint8 *)malloc(wavecvt.len*wavecvt.len_mult);
wavecvt.buf = (Uint8 *)calloc(1, wavecvt.len*wavecvt.len_mult);
if ( wavecvt.buf == NULL ) {
SDL_SetError("Out of memory");
SDL_FreeWAV(chunk->abuf);
Expand Down

0 comments on commit 1312544

Please sign in to comment.