History

avcodec/truemotion2: Cleanup generically on init failure

Andreas Rheinhardt committed 6 years ago

Commit fa1d1051 parent 52cd5501 file · +2 −11Browse files

Unified · Split

libavcodec/truemotion2.c+2−11
@@ -984,15 +984,6 @@ static av_cold int decode_init(AVCodecContext *avctx) · 983 unmodified lines
984 if (!l->Y1_base || !l->Y2_base || !l->U1_base ||984 if (!l->Y1_base || !l->Y2_base || !l->U1_base ||
985 !l->V1_base || !l->U2_base || !l->V2_base ||985 !l->V1_base || !l->U2_base || !l->V2_base ||
986 !l->last || !l->clast) {986 !l->last || !l->clast) {
987 av_freep(&l->Y1_base);
988 av_freep(&l->Y2_base);
989 av_freep(&l->U1_base);
990 av_freep(&l->U2_base);
991 av_freep(&l->V1_base);
992 av_freep(&l->V2_base);
993 av_freep(&l->last);
994 av_freep(&l->clast);
995 av_frame_free(&l->pic);
996 return AVERROR(ENOMEM);987 return AVERROR(ENOMEM);
997 }988 }
998 l->Y1 = l->Y1_base + l->y_stride * 4 + 4;989 l->Y1 = l->Y1_base + l->y_stride * 4 + 4;
@@ -1014,14 +1005,13 @@ static av_cold int decode_end(AVCodecContext *avctx) · 15 unmodified lines
1014 av_freep(&l->clast);1005 av_freep(&l->clast);
1015 for (i = 0; i < TM2_NUM_STREAMS; i++)1006 for (i = 0; i < TM2_NUM_STREAMS; i++)
1016 av_freep(&l->tokens[i]);1007 av_freep(&l->tokens[i]);
1017 if (l->Y1) {1008
1018 av_freep(&l->Y1_base);1009 av_freep(&l->Y1_base);
1019 av_freep(&l->U1_base);1010 av_freep(&l->U1_base);
1020 av_freep(&l->V1_base);1011 av_freep(&l->V1_base);
1021 av_freep(&l->Y2_base);1012 av_freep(&l->Y2_base);
1022 av_freep(&l->U2_base);1013 av_freep(&l->U2_base);
1023 av_freep(&l->V2_base);1014 av_freep(&l->V2_base);
1024 }
1025 av_freep(&l->buffer);1015 av_freep(&l->buffer);
1026 l->buffer_size = 0;1016 l->buffer_size = 0;
1027 1017
@@ -1040,4 +1030,5 @@ AVCodec ff_truemotion2_decoder = { · 12 unmodified lines
1040 .close = decode_end,1030 .close = decode_end,
1041 .decode = decode_frame,1031 .decode = decode_frame,
1042 .capabilities = AV_CODEC_CAP_DR1,1032 .capabilities = AV_CODEC_CAP_DR1,
1033 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
1043};1034};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t