Skip to content

Commit 4522eca

Browse files
authored
[raudio] Fixed memory leak on early-return of WaveFormat func (#4779)
In the case of a failure within miniaudio on the function: ma_convert_frames, the dynamic memory allocated for the `data` variable will leak on the early return.
1 parent c34ef35 commit 4522eca

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/raudio.c

+1
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,7 @@ void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels)
12401240
frameCount = (ma_uint32)ma_convert_frames(data, frameCount, formatOut, channels, sampleRate, wave->data, frameCountIn, formatIn, wave->channels, wave->sampleRate);
12411241
if (frameCount == 0)
12421242
{
1243+
RL_FREE(wave->data);
12431244
TRACELOG(LOG_WARNING, "WAVE: Failed format conversion");
12441245
return;
12451246
}

0 commit comments

Comments
 (0)