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
984984 if (!l->Y1_base || !l->Y2_base || !l->U1_base ||
985985 !l->V1_base || !l->U2_base || !l->V2_base ||
986986 !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);
996987 return AVERROR(ENOMEM);
997988 }
998989 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
10141005 av_freep(&l->clast);
10151006 for (i = 0; i < TM2_NUM_STREAMS; i++)
10161007 av_freep(&l->tokens[i]);
1017− if (l->Y1) {
1008+
10181009 av_freep(&l->Y1_base);
10191010 av_freep(&l->U1_base);
10201011 av_freep(&l->V1_base);
10211012 av_freep(&l->Y2_base);
10221013 av_freep(&l->U2_base);
10231014 av_freep(&l->V2_base);
1024− }
10251015 av_freep(&l->buffer);
10261016 l->buffer_size = 0;
10271017
@@ -1040,4 +1030,5 @@ AVCodec ff_truemotion2_decoder = { · 12 unmodified lines
10401030 .close = decode_end,
10411031 .decode = decode_frame,
10421032 .capabilities = AV_CODEC_CAP_DR1,
1033+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
10431034 };

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