From 4bfdcbe46dafb7c04e9db8d9af0468539e24dec1 Mon Sep 17 00:00:00 2001 From: "John K. Luebs" Date: Sun, 22 Jan 2023 08:10:10 -0600 Subject: [PATCH] audacious: Remove file leaks --- audacious/plugin.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/audacious/plugin.cc b/audacious/plugin.cc index 7a1ae62a..ba510a45 100644 --- a/audacious/plugin.cc +++ b/audacious/plugin.cc @@ -142,10 +142,11 @@ bool VgmstreamPlugin::is_our_file(const char * filename, VFSFile & file) { if (!sf) return false; VGMSTREAM* infostream = init_vgmstream_from_STREAMFILE(sf); + close_streamfile(sf); if (!infostream) { - close_streamfile(sf); return false; } + close_vgmstream(infostream); return true; } @@ -229,12 +230,11 @@ static bool read_info(const char* filename, Tuple & tuple) { sf->stream_index = subtune; VGMSTREAM* infostream = init_vgmstream_from_STREAMFILE(sf); + close_streamfile(sf); if (!infostream) { - close_streamfile(sf); return false; } - int total_subtunes = infostream->num_streams; // int was changed to short in some version, though vgmstream formats can exceed it @@ -245,7 +245,6 @@ static bool read_info(const char* filename, Tuple & tuple) { //set nullptr to leave subsong index linear (must add +1 to subtune) tuple.set_subtunes(total_subtunes, nullptr); - close_streamfile(sf); close_vgmstream(infostream); return true; } @@ -339,11 +338,9 @@ static bool read_info(const char* filename, Tuple & tuple) { vgmstream_tags_close(tags); close_streamfile(sf_tags); - } + } } - - close_streamfile(sf); close_vgmstream(infostream); return true; @@ -396,7 +393,6 @@ bool VgmstreamPlugin::play(const char * filename, VFSFile & file) { if (!vgmstream) { AUDINFO("filename %s is not a valid format\n", filename); - close_vgmstream(vgmstream); return false; } @@ -405,7 +401,6 @@ bool VgmstreamPlugin::play(const char * filename, VFSFile & file) { //todo apply config - apply_config(vgmstream, &settings); int input_channels = vgmstream->channels;