Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Jianhua <jianhua.wu@intel.com>2021-12-09 12:36:52 +0300
committerLynne <dev@lynne.ee>2021-12-10 14:38:43 +0300
commitceeff7ae8d918cd54a9b1c8deb85184da53f1250 (patch)
tree4456d189e2dd04271d9adab8e9ffae34649f6716 /libavfilter/vf_transpose.c
parent4f44a218e53cd92e64ba10a935bc1e7583c3e218 (diff)
avfilter/vf_transpose: fix un-checked potential memory allocation failure
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
Diffstat (limited to 'libavfilter/vf_transpose.c')
-rw-r--r--libavfilter/vf_transpose.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index f9f0d70cd5..b964daeee3 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -328,6 +328,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
+ int err = 0;
AVFilterContext *ctx = inlink->dst;
TransContext *s = ctx->priv;
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);
if (!out) {
- av_frame_free(&in);
- return AVERROR(ENOMEM);
+ err = 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) {
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)));
av_frame_free(&in);
return ff_filter_frame(outlink, out);
+
+fail:
+ av_frame_free(&in);
+ av_frame_free(&out);
+ return err;
}
#define OFFSET(x) offsetof(TransContext, x)