[FFmpeg-soc] [soc]: r5265 - concat/libavformat/pls.c

gkovacs subversion at mplayerhq.hu
Tue Aug 25 09:16:57 CEST 2009


Author: gkovacs
Date: Tue Aug 25 09:16:57 2009
New Revision: 5265

Log:
check for realloc failure in pls_list_files

Modified:
   concat/libavformat/pls.c

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Tue Aug 25 09:15:02 2009	(r5264)
+++ concat/libavformat/pls.c	Tue Aug 25 09:16:57 2009	(r5265)
@@ -48,7 +48,7 @@ static int pls_list_files(ByteIOContext 
     int i, j, c;
     unsigned int buflen;
     char state;
-    char **flist;
+    char **flist, **flist_tmp;
     char buf[1024];
     char buf_tag[5] = {0};
     const char match_tag[] = "\nFile";
@@ -71,7 +71,13 @@ static int pls_list_files(ByteIOContext 
             if (c == '\n' || 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