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

gkovacs subversion at mplayerhq.hu
Wed Aug 26 20:44:58 CEST 2009


Author: gkovacs
Date: Wed Aug 26 20:44:58 2009
New Revision: 5314

Log:
don't free list upon failed insertion or removal

Modified:
   concat/libavformat/avplaylist.c

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Wed Aug 26 20:41:39 2009	(r5313)
+++ concat/libavformat/avplaylist.c	Wed Aug 26 20:44:58 2009	(r5314)
@@ -49,8 +49,6 @@ int av_playlist_insert_item(AVPlaylistCo
     flist_tmp = av_realloc(ctx->flist, sizeof(*(ctx->flist)) * (++ctx->pelist_size+1));
     if (!flist_tmp) {
         av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_insert_item\n");
-        av_free(ctx->flist);
-        ctx->flist = NULL;
         return AVERROR_NOMEM;
     } else
         ctx->flist = flist_tmp;
@@ -60,7 +58,6 @@ int av_playlist_insert_item(AVPlaylistCo
     ctx->flist[pos] = av_malloc(itempath_len + 1);
     if (!ctx->flist[pos]) {
         av_log(NULL, AV_LOG_ERROR, "av_malloc error in av_playlist_insert_item\n");
-        ctx->flist[pos] = NULL;
         return AVERROR_NOMEM;
     }
     av_strlcpy(ctx->flist[pos], itempath, itempath_len + 1);
@@ -69,8 +66,6 @@ int av_playlist_insert_item(AVPlaylistCo
                                sizeof(*(ctx->durations)) * (ctx->pelist_size+1));
     if (!durations_tmp) {
         av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_insert_item\n");
-        av_free(ctx->durations);
-        ctx->durations = NULL;
         return AVERROR_NOMEM;
     } else
         ctx->durations = durations_tmp;
@@ -82,8 +77,6 @@ int av_playlist_insert_item(AVPlaylistCo
                                      sizeof(*(ctx->nb_streams_list)) * (ctx->pelist_size+1));
     if (!nb_streams_list_tmp) {
         av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_insert_item\n");
-        av_free(ctx->nb_streams_list);
-        ctx->nb_streams_list = NULL;
         return AVERROR_NOMEM;
     } else
         ctx->nb_streams_list = nb_streams_list_tmp;
@@ -122,8 +115,6 @@ int av_playlist_remove_item(AVPlaylistCo
     flist_tmp = av_realloc(ctx->flist, sizeof(*(ctx->flist)) * (--ctx->pelist_size+1));
     if (!flist_tmp) {
         av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_remove_item\n");
-        av_free(ctx->flist);
-        ctx->flist = NULL;
         return AVERROR_NOMEM;
     } else
         ctx->flist = flist_tmp;
@@ -134,8 +125,6 @@ int av_playlist_remove_item(AVPlaylistCo
                                sizeof(*(ctx->durations)) * (ctx->pelist_size+1));
     if (!durations_tmp) {
         av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_remove_item\n");
-        av_free(ctx->durations);
-        ctx->durations = NULL;
         return AVERROR_NOMEM;
     } else
         ctx->durations = durations_tmp;
@@ -146,8 +135,6 @@ int av_playlist_remove_item(AVPlaylistCo
                                      sizeof(*(ctx->nb_streams_list)) * (ctx->pelist_size+1));
     if (!nb_streams_list_tmp) {
         av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_remove_item\n");
-        av_free(ctx->nb_streams_list);
-        ctx->nb_streams_list = NULL;
         return AVERROR_NOMEM;
     } else
         ctx->nb_streams_list = nb_streams_list_tmp;
@@ -164,7 +151,6 @@ int av_playlist_remove_item(AVPlaylistCo
                                         sizeof(*(ctx->formatcontext_list)) * (ctx->pelist_size+1));
     if (!formatcontext_list_tmp) {
         av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_remove_item\n");
-        av_free(ctx->formatcontext_list);
         return AVERROR_NOMEM;
     } else
         ctx->formatcontext_list = formatcontext_list_tmp;


More information about the FFmpeg-soc mailing list