[FFmpeg-cvslog] rdt: Check the return value of avformat_open

Martin Storsjö git at videolan.org
Tue Nov 8 02:22:01 CET 2011


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sun Nov  6 23:51:19 2011 +0200| [ed307e2659f2db81a434afece905383fdceb9b6e] | committer: Martin Storsjö

rdt: Check the return value of avformat_open

If it failed, return NULL. This avoids trying to use an
half-initialized RDTDemuxContext.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed307e2659f2db81a434afece905383fdceb9b6e
---

 libavformat/rdt.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index 3f161f6..f492805 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;
 }



More information about the ffmpeg-cvslog mailing list