decoder/ffmpeg: free AVFormatContext on error
Fix a memory leak in some code paths.
This commit is contained in:
parent
0d03bdce6d
commit
814daac5ba
1
NEWS
1
NEWS
@ -4,6 +4,7 @@ ver 0.15.11 (2010/??/??)
|
|||||||
* decoders:
|
* decoders:
|
||||||
- mp4ff: support tags "album artist", "albumartist", "band"
|
- mp4ff: support tags "album artist", "albumartist", "band"
|
||||||
- mikmod: fix memory leak
|
- mikmod: fix memory leak
|
||||||
|
- ffmpeg: free AVFormatContext on error
|
||||||
* playlist: emit IDLE_OPTIONS when resetting single mode
|
* playlist: emit IDLE_OPTIONS when resetting single mode
|
||||||
* listen: make get_remote_uid() work on BSD
|
* listen: make get_remote_uid() work on BSD
|
||||||
|
|
||||||
|
@ -192,12 +192,14 @@ ffmpeg_helper(const char *uri, struct input_stream *input,
|
|||||||
|
|
||||||
if (av_find_stream_info(format_context)<0) {
|
if (av_find_stream_info(format_context)<0) {
|
||||||
g_warning("Couldn't find stream info\n");
|
g_warning("Couldn't find stream info\n");
|
||||||
|
av_close_input_file(format_context);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
audio_stream = ffmpeg_find_audio_stream(format_context);
|
audio_stream = ffmpeg_find_audio_stream(format_context);
|
||||||
if (audio_stream == -1) {
|
if (audio_stream == -1) {
|
||||||
g_warning("No audio stream inside\n");
|
g_warning("No audio stream inside\n");
|
||||||
|
av_close_input_file(format_context);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,11 +211,13 @@ ffmpeg_helper(const char *uri, struct input_stream *input,
|
|||||||
|
|
||||||
if (!codec) {
|
if (!codec) {
|
||||||
g_warning("Unsupported audio codec\n");
|
g_warning("Unsupported audio codec\n");
|
||||||
|
av_close_input_file(format_context);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avcodec_open(codec_context, codec)<0) {
|
if (avcodec_open(codec_context, codec)<0) {
|
||||||
g_warning("Could not open codec\n");
|
g_warning("Could not open codec\n");
|
||||||
|
av_close_input_file(format_context);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user