[FFmpeg-soc] [soc]: r5266 - concat/libavformat/xspf.c

gkovacs subversion at mplayerhq.hu
Tue Aug 25 09:18:01 CEST 2009


Author: gkovacs
Date: Tue Aug 25 09:18:01 2009
New Revision: 5266

Log:
check for realloc failure in xspf_list_files

Modified:
   concat/libavformat/xspf.c

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Tue Aug 25 09:16:57 2009	(r5265)
+++ concat/libavformat/xspf.c	Tue Aug 25 09:18:01 2009	(r5266)
@@ -76,7 +76,7 @@ static int xspf_list_files(ByteIOContext
     int i, j, c;
     unsigned int buflen;
     char state;
-    char **flist;
+    char **flist, **flist_tmp;
     char buf[1024];
     char buf_tag[10] = {0};
     const char match_tag[] = "<location>";
@@ -94,7 +94,13 @@ static int xspf_list_files(ByteIOContext
             if (c == '<') {
                 termfn:
                 buf[i++] = 0;
-                flist = av_fast_realloc(flist, &buflen, sizeof(*flist) * (j+2));
+                flist_tmp = av_fast_realloc(flist, &buflen, sizeof(*flist) * (j+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[j] = av_malloc(i);
                 av_strlcpy(flist[j++], buf, i);
                 i = 0;


More information about the FFmpeg-soc mailing list