瀏覽代碼

[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.
pull/4787/head
Ralph Caraveo 3 週之前
committed by GitHub
父節點
當前提交
4522ecae1a
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: B5690EEEBB952194
共有 1 個檔案被更改,包括 1 行新增0 行删除
  1. +1
    -0
      src/raudio.c

+ 1
- 0
src/raudio.c 查看文件

@ -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);
if (frameCount == 0)
{
RL_FREE(wave->data);
TRACELOG(LOG_WARNING, "WAVE: Failed format conversion");
return;
}

Loading…
取消
儲存