mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-16 16:28:14 +00:00
[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.
This commit is contained in:
@@ -1240,6 +1240,7 @@ void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels)
|
|||||||
frameCount = (ma_uint32)ma_convert_frames(data, frameCount, formatOut, channels, sampleRate, wave->data, frameCountIn, formatIn, wave->channels, wave->sampleRate);
|
frameCount = (ma_uint32)ma_convert_frames(data, frameCount, formatOut, channels, sampleRate, wave->data, frameCountIn, formatIn, wave->channels, wave->sampleRate);
|
||||||
if (frameCount == 0)
|
if (frameCount == 0)
|
||||||
{
|
{
|
||||||
|
RL_FREE(wave->data);
|
||||||
TRACELOG(LOG_WARNING, "WAVE: Failed format conversion");
|
TRACELOG(LOG_WARNING, "WAVE: Failed format conversion");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user