From ed307e2659f2db81a434afece905383fdceb9b6e Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Sun, 6 Nov 2011 23:51:19 +0200 Subject: rdt: Check the return value of avformat_open MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If it failed, return NULL. This avoids trying to use an half-initialized RDTDemuxContext. Signed-off-by: Martin Storsjö --- libavformat/rdt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libavformat/rdt.c') diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 3f161f618c..f492805d13 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -524,7 +524,11 @@ rdt_new_context (void) { PayloadContext *rdt = av_mallocz(sizeof(PayloadContext)); - avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL); + int ret = avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL); + if (ret < 0) { + av_free(rdt); + return NULL; + } return rdt; } -- cgit v1.2.3