History

avfilter/vf_colorspace: fix memmory leaks

Fixes #8303

Paul B Mahol committed 7 years ago

Commit fddef961 parent daf2bef1 file · +11 −2Browse files

Unified · Split

libavfilter/vf_colorspace.c+11−2
@@ -780,6 +780,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 779 unmodified lines
780780 res = av_frame_copy_props(out, in);
781781 if (res < 0) {
782782 av_frame_free(&in);
783+ av_frame_free(&out);
783784 return res;
784785 }
785786
@@ -839,13 +840,18 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 53 unmodified lines
839840 !s->dither_scratch_base[1][0] || !s->dither_scratch_base[1][1] ||
840841 !s->dither_scratch_base[2][0] || !s->dither_scratch_base[2][1]) {
841842 uninit(ctx);
843+ av_frame_free(&in);
844+ av_frame_free(&out);
842845 return AVERROR(ENOMEM);
843846 }
844847 s->rgb_sz = rgb_sz;
845848 }
846849 res = create_filtergraph(ctx, in, out);
847− if (res < 0)
850+ if (res < 0) {
851+ av_frame_free(&in);
852+ av_frame_free(&out);
848853 return res;
854+ }
849855 s->rgb_stride = rgb_stride / sizeof(int16_t);
850856 td.in = in;
851857 td.out = out;
@@ -859,8 +865,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 7 unmodified lines
859865 td.out_ss_h = av_pix_fmt_desc_get(out->format)->log2_chroma_h;
860866 if (s->yuv2yuv_passthrough) {
861867 res = av_frame_copy(out, in);
862− if (res < 0)
868+ if (res < 0) {
869+ av_frame_free(&in);
870+ av_frame_free(&out);
863871 return res;
872+ }
864873 } else {
865874 ctx->internal->execute(ctx, convert, &td, NULL,
866875 FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx)));

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