Skip to content

Commit

Permalink
fix memory leaks in Parse* (music_wav.c)
Browse files Browse the repository at this point in the history
  • Loading branch information
pionere authored and sezero committed Dec 12, 2021
1 parent 643870a commit 85a617c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/codecs/music_wav.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ static SDL_bool ParseFMT(WAV_Music *wave, Uint32 chunk_length)
}
if (!SDL_RWread(wave->src, data, chunk_length, 1)) {
Mix_SetError("Couldn't read %d bytes from WAV file", chunk_length);
return SDL_FALSE;
goto done;
}
format = (WaveFMT *)data;

Expand Down Expand Up @@ -785,6 +785,7 @@ static SDL_bool ParseSMPL(WAV_Music *wave, Uint32 chunk_length)
}
if (!SDL_RWread(wave->src, data, chunk_length, 1)) {
Mix_SetError("Couldn't read %d bytes from WAV file", chunk_length);
SDL_free(data);
return SDL_FALSE;
}
chunk = (SamplerChunk *)data;
Expand Down Expand Up @@ -835,6 +836,7 @@ static SDL_bool ParseLIST(WAV_Music *wave, Uint32 chunk_length)

if (!SDL_RWread(wave->src, data, chunk_length, 1)) {
Mix_SetError("Couldn't read %d bytes from WAV file", chunk_length);
SDL_free(data);
return SDL_FALSE;
}

Expand Down

0 comments on commit 85a617c

Please sign in to comment.