[FFmpeg-soc] [soc]: r5186 - concat/libavformat/playlist.c

gkovacs subversion at mplayerhq.hu
Thu Aug 20 11:18:37 CEST 2009


Author: gkovacs
Date: Thu Aug 20 11:18:37 2009
New Revision: 5186

Log:
check for memory allocation failures

Modified:
   concat/libavformat/playlist.c

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Thu Aug 20 10:56:59 2009	(r5185)
+++ concat/libavformat/playlist.c	Thu Aug 20 11:18:37 2009	(r5186)
@@ -111,6 +111,10 @@ void ff_playlist_split_encodedstring(con
         if (c == sep) {
             sepidx[len] = ts-s;
             sepidx = av_fast_realloc(sepidx, &buflen, ++len);
+            if (!sepidx) {
+                av_log(NULL, AV_LOG_ERROR, "av_fast_realloc error in ff_playlist_split_encodedstring\n");
+                continue;
+            }
         }
     }
     sepidx[len] = ts-s;
@@ -120,6 +124,10 @@ void ff_playlist_split_encodedstring(con
     flist[len] = 0;
     for (i = 0; i < len; ++i) {
         flist[i] = av_malloc(sepidx[i+1]-sepidx[i]);
+        if (!flist[i]) {
+            av_log(NULL, AV_LOG_ERROR, "av_malloc error in ff_playlist_split_encodedstring\n");
+            continue;
+        }
         av_strlcpy(flist[i], ts+sepidx[i], sepidx[i+1]-sepidx[i]);
     }
     av_free(sepidx);
@@ -138,6 +146,10 @@ PlaylistContext *ff_playlist_from_encode
         return NULL;
     }
     ctx = av_mallocz(sizeof(*ctx));
+    if (!ctx) {
+        av_log(NULL, AV_LOG_ERROR, "av_mallocz error in ff_playlist_from_encodedstring\n");
+        return NULL;
+    }
     for (i = 0; i < len; ++i)
         ff_playlist_add_path(ctx, flist[i]);
     return ctx;


More information about the FFmpeg-soc mailing list