avfilter/vf_qp: fix cleanup on error

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-04-21 14:11:30 +02:00
parent a924b83ccc
commit 8f9a3817d5
1 changed files with 4 additions and 2 deletions

View File

@ -90,7 +90,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterLink *outlink = ctx->outputs[0]; AVFilterLink *outlink = ctx->outputs[0];
QPContext *s = ctx->priv; QPContext *s = ctx->priv;
AVBufferRef *out_qp_table_buf; AVBufferRef *out_qp_table_buf;
AVFrame *out; AVFrame *out = NULL;
const int8_t *in_qp_table; const int8_t *in_qp_table;
int type, stride, ret; int type, stride, ret;
@ -129,7 +129,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
var_names, var_values, var_names, var_values,
NULL, NULL, NULL, NULL, 0, 0, ctx); NULL, NULL, NULL, NULL, 0, 0, ctx);
if (ret < 0) if (ret < 0)
return ret; goto fail;
out_qp_table_buf->data[x + s->qstride * y] = lrintf(temp_val); out_qp_table_buf->data[x + s->qstride * y] = lrintf(temp_val);
} }
} else if (in_qp_table) { } else if (in_qp_table) {
@ -148,8 +148,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
} }
ret = ff_filter_frame(outlink, out); ret = ff_filter_frame(outlink, out);
out = NULL;
fail: fail:
av_frame_free(&in); av_frame_free(&in);
av_frame_free(&out);
return ret; return ret;
} }