diff options
author | Max Kellermann <max@duempel.org> | 2010-01-18 11:05:15 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-01-18 11:05:15 +0100 |
commit | acd3f8cd91f979c0961218a154c3cd4a9e3acf6c (patch) | |
tree | 069b51b33b734fd8386aa3dac7af397dd5099e0a | |
parent | ca1fc13116cbac10711455b4e57e242b967c6f6e (diff) | |
download | mpd-acd3f8cd91f979c0961218a154c3cd4a9e3acf6c.tar.gz mpd-acd3f8cd91f979c0961218a154c3cd4a9e3acf6c.tar.xz mpd-acd3f8cd91f979c0961218a154c3cd4a9e3acf6c.zip |
decoder/ffmpeg: free AVFormatContext on error
Fix a memory leak in some code paths.
-rw-r--r-- | src/decoder/ffmpeg_decoder_plugin.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c index 1ecc9e013..df05edd47 100644 --- a/src/decoder/ffmpeg_decoder_plugin.c +++ b/src/decoder/ffmpeg_decoder_plugin.c @@ -193,12 +193,14 @@ ffmpeg_helper(struct input_stream *input, if (av_find_stream_info(format_context)<0) { g_warning("Couldn't find stream info\n"); + av_close_input_file(format_context); return false; } audio_stream = ffmpeg_find_audio_stream(format_context); if (audio_stream == -1) { g_warning("No audio stream inside\n"); + av_close_input_file(format_context); return false; } @@ -210,11 +212,13 @@ ffmpeg_helper(struct input_stream *input, if (!codec) { g_warning("Unsupported audio codec\n"); + av_close_input_file(format_context); return false; } if (avcodec_open(codec_context, codec)<0) { g_warning("Could not open codec\n"); + av_close_input_file(format_context); return false; } |