From db5911f811c34a689bff519df323c4b3de5dd78a Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Fri, 30 Oct 2020 11:49:22 +0100 Subject: [PATCH] Free the audiofile structs on `st_close` Otherwise they leak --- external/st_audiofile/src/st_audiofile.c | 2 +- external/st_audiofile/src/st_audiofile_sndfile.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/external/st_audiofile/src/st_audiofile.c b/external/st_audiofile/src/st_audiofile.c index 81eb5d47..57511bb7 100644 --- a/external/st_audiofile/src/st_audiofile.c +++ b/external/st_audiofile/src/st_audiofile.c @@ -155,7 +155,7 @@ void st_close(st_audio_file* af) break; } - af->type = st_audio_file_null; + free(af); } int st_get_type(st_audio_file* af) diff --git a/external/st_audiofile/src/st_audiofile_sndfile.c b/external/st_audiofile/src/st_audiofile_sndfile.c index 5b3e9b9e..480daa34 100644 --- a/external/st_audiofile/src/st_audiofile_sndfile.c +++ b/external/st_audiofile/src/st_audiofile_sndfile.c @@ -52,10 +52,10 @@ st_audio_file* st_open_file_w(const wchar_t* filename) void st_close(st_audio_file* af) { - if (af->snd) { + if (af->snd) sf_close(af->snd); - af->snd = NULL; - } + + free(af); } int st_get_type(st_audio_file* af)