mirror of https://git.ffmpeg.org/ffmpeg.git
avfilter/vf_transpose: fix un-checked potential memory allocation failure
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
This commit is contained in:
parent
4f44a218e5
commit
ceeff7ae8d
|
@ -328,6 +328,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
|
||||||
|
|
||||||
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||||
{
|
{
|
||||||
|
int err = 0;
|
||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
TransContext *s = ctx->priv;
|
TransContext *s = ctx->priv;
|
||||||
AVFilterLink *outlink = ctx->outputs[0];
|
AVFilterLink *outlink = ctx->outputs[0];
|
||||||
|
@ -339,10 +340,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||||
|
|
||||||
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_frame_free(&in);
|
err = AVERROR(ENOMEM);
|
||||||
return AVERROR(ENOMEM);
|
goto fail;
|
||||||
}
|
}
|
||||||
av_frame_copy_props(out, in);
|
|
||||||
|
err = av_frame_copy_props(out, in);
|
||||||
|
if (err < 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
if (in->sample_aspect_ratio.num == 0) {
|
if (in->sample_aspect_ratio.num == 0) {
|
||||||
out->sample_aspect_ratio = in->sample_aspect_ratio;
|
out->sample_aspect_ratio = in->sample_aspect_ratio;
|
||||||
|
@ -356,6 +360,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||||
FFMIN(outlink->h, ff_filter_get_nb_threads(ctx)));
|
FFMIN(outlink->h, ff_filter_get_nb_threads(ctx)));
|
||||||
av_frame_free(&in);
|
av_frame_free(&in);
|
||||||
return ff_filter_frame(outlink, out);
|
return ff_filter_frame(outlink, out);
|
||||||
|
|
||||||
|
fail:
|
||||||
|
av_frame_free(&in);
|
||||||
|
av_frame_free(&out);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OFFSET(x) offsetof(TransContext, x)
|
#define OFFSET(x) offsetof(TransContext, x)
|
||||||
|
|
Loading…
Reference in New Issue