[FFmpeg-soc] [soc]: r5381 - concat/libavformat/avplaylist.c

gkovacs subversion at mplayerhq.hu
Thu Sep 3 21:51:24 CEST 2009


Author: gkovacs
Date: Thu Sep  3 21:51:23 2009
New Revision: 5381

Log:
merge together av_realloc error checking in insert_item

Modified:
   concat/libavformat/avplaylist.c

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Thu Sep  3 21:44:42 2009	(r5380)
+++ concat/libavformat/avplaylist.c	Thu Sep  3 21:51:23 2009	(r5381)
@@ -51,36 +51,25 @@ int av_playlist_insert_item(AVPlaylistCo
     AVFormatContext *ic;
     ++ctx->pelist_size;
     flist_tmp = av_realloc(ctx->flist, sizeof(*(ctx->flist)) * ctx->pelist_size);
-    if (!flist_tmp) {
-        av_log(ctx, AV_LOG_ERROR,
-               "av_realloc error for flist in av_playlist_insert_item\n");
-        return AVERROR_NOMEM;
-    } else
-        ctx->flist = flist_tmp;
     durations_tmp = av_realloc(ctx->durations,
                                sizeof(*(ctx->durations)) * ctx->pelist_size);
-    if (!durations_tmp) {
-        av_log(ctx, AV_LOG_ERROR,
-               "av_realloc error for durations in av_playlist_insert_item\n");
-        return AVERROR_NOMEM;
-    } else
-        ctx->durations = durations_tmp;
     nb_streams_list_tmp = av_realloc(ctx->nb_streams_list,
                                      sizeof(*(ctx->nb_streams_list)) * ctx->pelist_size);
-    if (!nb_streams_list_tmp) {
-        av_log(ctx, AV_LOG_ERROR,
-               "av_realloc error for nb_streams_list in av_playlist_insert_item\n");
-        return AVERROR_NOMEM;
-    } else
-        ctx->nb_streams_list = nb_streams_list_tmp;
     formatcontext_list_tmp = av_realloc(ctx->formatcontext_list,
                                         sizeof(*(ctx->formatcontext_list)) * ctx->pelist_size);
-    if (!formatcontext_list_tmp) {
+    if (!flist_tmp ||
+        !durations_tmp ||
+        !nb_streams_list_tmp ||
+        !formatcontext_list_tmp) {
         av_log(ctx, AV_LOG_ERROR,
-               "av_realloc error for formatcontext_list in av_playlist_insert_item\n");
+               "av_realloc error in av_playlist_insert_item\n");
         return AVERROR_NOMEM;
-    } else
+    } else {
+        ctx->flist              = flist_tmp;
+        ctx->durations          = durations_tmp;
+        ctx->nb_streams_list    = nb_streams_list_tmp;
         ctx->formatcontext_list = formatcontext_list_tmp;
+    }
     ic = ff_playlist_alloc_formatcontext(itempath);
     if (!ic) {
         av_log(ctx, AV_LOG_ERROR,


More information about the FFmpeg-soc mailing list