From 4e59c8ecf1433b85b539c5e89bb68cfe8b839866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Tue, 5 Jul 2011 23:10:44 +0200 Subject: [PATCH] Fix av_open_input_stream with uninitialized context pointer. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Code would allocate a new context but forget to assign it to the pointer actually passed to avformat_open_input, potentially causing a crash. Even if it was initialized it would cause a memleak. This caused crashes with e.g. mpd, see also http://bugs.gentoo.org/show_bug.cgi?id=373423 Signed-off-by: Reimar Döffinger --- libavformat/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 989ddaca07..9a7d6b7a20 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -458,7 +458,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, opts = convert_format_parameters(ap); if(!ap->prealloced_context) - ic = avformat_alloc_context(); + *ic_ptr = ic = avformat_alloc_context(); else ic = *ic_ptr; if (!ic) {