From 9df9c17d2c1686f7360d7f23cfbeea9e0dfd1e5b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Mar 2016 13:39:39 +0500 Subject: ImBuf: Use proper function to free FFmpeg frames --- source/blender/imbuf/intern/anim_movie.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 05e6b25b9a5..1d7c5da0c5b 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -569,9 +569,9 @@ static int startffmpeg(struct anim *anim) fprintf(stderr, "Could not allocate frame data.\n"); avcodec_close(anim->pCodecCtx); avformat_close_input(&anim->pFormatCtx); - av_free(anim->pFrameRGB); - av_free(anim->pFrameDeinterlaced); - av_free(anim->pFrame); + av_frame_free(&anim->pFrameRGB); + av_frame_free(&anim->pFrameDeinterlaced); + av_frame_free(&anim->pFrame); anim->pCodecCtx = NULL; return -1; } @@ -584,9 +584,9 @@ static int startffmpeg(struct anim *anim) "ffmpeg has changed alloc scheme ... ARGHHH!\n"); avcodec_close(anim->pCodecCtx); avformat_close_input(&anim->pFormatCtx); - av_free(anim->pFrameRGB); - av_free(anim->pFrameDeinterlaced); - av_free(anim->pFrame); + av_frame_free(&anim->pFrameRGB); + av_frame_free(&anim->pFrameDeinterlaced); + av_frame_free(&anim->pFrame); anim->pCodecCtx = NULL; return -1; } @@ -625,9 +625,9 @@ static int startffmpeg(struct anim *anim) "Can't transform color space??? Bailing out...\n"); avcodec_close(anim->pCodecCtx); avformat_close_input(&anim->pFormatCtx); - av_free(anim->pFrameRGB); - av_free(anim->pFrameDeinterlaced); - av_free(anim->pFrame); + av_frame_free(&anim->pFrameRGB); + av_frame_free(&anim->pFrameDeinterlaced); + av_frame_free(&anim->pFrame); anim->pCodecCtx = NULL; return -1; } @@ -1163,13 +1163,9 @@ static void free_anim_ffmpeg(struct anim *anim) if (anim->pCodecCtx) { avcodec_close(anim->pCodecCtx); avformat_close_input(&anim->pFormatCtx); - av_free(anim->pFrameRGB); - av_free(anim->pFrame); - - if (anim->ib_flags & IB_animdeinterlace) { - MEM_freeN(anim->pFrameDeinterlaced->data[0]); - } - av_free(anim->pFrameDeinterlaced); + av_frame_free(&anim->pFrameRGB); + av_frame_free(&anim->pFrame); + av_frame_free(&anim->pFrameDeinterlaced); sws_freeContext(anim->img_convert_ctx); IMB_freeImBuf(anim->last_frame); if (anim->next_packet.stream_index != -1) { -- cgit v1.2.3