[FFmpeg-soc] [soc]: r5264 - concat/libavformat/m3u.c

gkovacs subversion at mplayerhq.hu
Tue Aug 25 09:15:02 CEST 2009


Author: gkovacs
Date: Tue Aug 25 09:15:02 2009
New Revision: 5264

Log:
check for realloc failure in m3u_list_files

Modified:
   concat/libavformat/m3u.c

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Tue Aug 25 09:09:38 2009	(r5263)
+++ concat/libavformat/m3u.c	Tue Aug 25 09:15:02 2009	(r5264)
@@ -45,7 +45,7 @@ static int m3u_probe(AVProbeData *p)
 
 static int m3u_list_files(ByteIOContext *s, char ***flist_ptr, int *len_ptr)
 {
-    char **flist;
+    char **flist, **flist_tmp;
     int i, bufsize;
     flist = NULL;
     i = bufsize = 0;
@@ -61,7 +61,13 @@ static int m3u_list_files(ByteIOContext 
         }
         if (*linebuf == 0) // hashed out
             continue;
-        flist = av_fast_realloc(flist, &bufsize, i+2);
+        flist_tmp = av_fast_realloc(flist, &bufsize, i+2);
+        if (!flist_tmp) {
+            av_log(NULL, AV_LOG_ERROR, "av_realloc error in m3u_list_files\n");
+            av_free(flist);
+            return AVERROR_NOMEM;
+        } else
+            flist = flist_tmp;
         flist[i] = av_malloc(q-linebuf+1);
         av_strlcpy(flist[i], linebuf, q-linebuf+1);
         flist[i++][q-linebuf] = 0;


More information about the FFmpeg-soc mailing list