[FFmpeg-cvslog] r19826 - trunk/ffmpeg.c

ramiro subversion
Sat Sep 12 19:22:56 CEST 2009


Author: ramiro
Date: Sat Sep 12 19:22:56 2009
New Revision: 19826

Log:
Check for return value of some context allocations.

Modified:
   trunk/ffmpeg.c

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	Sat Sep 12 18:23:13 2009	(r19825)
+++ trunk/ffmpeg.c	Sat Sep 12 19:22:56 2009	(r19826)
@@ -483,6 +483,10 @@ static int read_ffserver_streams(AVForma
         st = av_mallocz(sizeof(AVStream));
         memcpy(st, ic->streams[i], sizeof(AVStream));
         st->codec = avcodec_alloc_context();
+        if (!st->codec) {
+            print_error(filename, AVERROR(ENOMEM));
+            av_exit(1);
+        }
         memcpy(st->codec, ic->streams[i]->codec, sizeof(AVCodecContext));
         s->streams[i] = st;
 
@@ -2836,6 +2840,10 @@ static void opt_input_file(const char *f
 
     /* get default parameters from command line */
     ic = avformat_alloc_context();
+    if (!ic) {
+        print_error(filename, AVERROR(ENOMEM));
+        av_exit(1);
+    }
 
     memset(ap, 0, sizeof(*ap));
     ap->prealloced_context = 1;
@@ -3332,6 +3340,10 @@ static void opt_output_file(const char *
         filename = "pipe:";
 
     oc = avformat_alloc_context();
+    if (!oc) {
+        print_error(filename, AVERROR(ENOMEM));
+        av_exit(1);
+    }
 
     if (!file_oformat) {
         file_oformat = guess_format(NULL, filename, NULL);



More information about the ffmpeg-cvslog mailing list