1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/vf_colorconstancy: fix memory leak on error

Also remove unneeded log message while here.
This commit is contained in:
Paul B Mahol 2020-01-27 16:52:11 +01:00
parent dfc4714886
commit 32ea6ffb16

View File

@ -121,7 +121,6 @@ static int set_gauss(AVFilterContext *ctx)
for (; i >= 0; --i) { for (; i >= 0; --i) {
av_freep(&s->gauss[i]); av_freep(&s->gauss[i]);
} }
av_log(ctx, AV_LOG_ERROR, "Out of memory while allocating gauss buffers.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
} }
@ -223,7 +222,6 @@ static int setup_derivative_buffers(AVFilterContext* ctx, ThreadData *td)
td->data[b][p] = av_mallocz_array(s->planeheight[p] * s->planewidth[p], sizeof(*td->data[b][p])); td->data[b][p] = av_mallocz_array(s->planeheight[p] * s->planewidth[p], sizeof(*td->data[b][p]));
if (!td->data[b][p]) { if (!td->data[b][p]) {
cleanup_derivative_buffers(td, b + 1, p); cleanup_derivative_buffers(td, b + 1, p);
av_log(ctx, AV_LOG_ERROR, "Out of memory while allocating derivatives buffers.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
} }
@ -696,7 +694,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
} else { } else {
out = ff_get_video_buffer(outlink, outlink->w, outlink->h); out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) { if (!out) {
av_log(ctx, AV_LOG_ERROR, "Out of memory while allocating output video buffer.\n"); av_frame_free(&in);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
av_frame_copy_props(out, in); av_frame_copy_props(out, in);