rdt: Check the return value of avformat_open
authorMartin Storsjö <martin@martin.st>
Sun, 6 Nov 2011 21:51:19 +0000 (23:51 +0200)
committerMartin Storsjö <martin@martin.st>
Mon, 7 Nov 2011 09:23:57 +0000 (11:23 +0200)
If it failed, return NULL. This avoids trying to use an
half-initialized RDTDemuxContext.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/rdt.c

index 3f161f6..f492805 100644 (file)
@@ -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;
 }