aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-01-18 11:05:15 +0100
committerMax Kellermann <max@duempel.org>2010-06-30 23:14:43 +0200
commit814daac5bae1e7e3a67cd7ed727bd1fe6b9a3889 (patch)
tree1bd45c9a50b2436edf5287a27550bd7bf6e91f33 /src
parent0d03bdce6d590429143e821e2bcf34142b57b8fa (diff)
downloadmpd-814daac5bae1e7e3a67cd7ed727bd1fe6b9a3889.tar.gz
mpd-814daac5bae1e7e3a67cd7ed727bd1fe6b9a3889.tar.xz
mpd-814daac5bae1e7e3a67cd7ed727bd1fe6b9a3889.zip
decoder/ffmpeg: free AVFormatContext on error
Fix a memory leak in some code paths.
Diffstat (limited to 'src')
-rw-r--r--src/decoder/ffmpeg_plugin.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index 2a46601f4..2e06c13f8 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -192,12 +192,14 @@ ffmpeg_helper(const char *uri, 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;
}
@@ -209,11 +211,13 @@ ffmpeg_helper(const char *uri, 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;
}