summaryrefslogtreecommitdiff
path: root/libavfilter/vf_sr.c
diff options
context:
space:
mode:
authorTing Fu <ting.fu-at-intel.com@ffmpeg.org>2022-06-27 18:02:30 +0800
committerGuo Yejun <yejun.guo@intel.com>2022-07-22 08:15:04 +0800
commit130d19bf2044ac76372d1b97ab87ab283c8b37f8 (patch)
tree3720453ca5601f33bae0eb196f4782b3be41e7f3 /libavfilter/vf_sr.c
parent4e145f1dcdcbe19e8f8e98940dab04e9332a8b5b (diff)
lavf/sr: fix the segmentation fault caused by incorrect input frame free.
This issue would cause segmetaion fault when running srcnn model with sr filter by TensorFlow backend. This filter would free the frame incorectly. Signed-off-by: Ting Fu <ting.fu@intel.com>
Diffstat (limited to 'libavfilter/vf_sr.c')
-rw-r--r--libavfilter/vf_sr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c
index 0890c8ba18..cb24c096ce 100644
--- a/libavfilter/vf_sr.c
+++ b/libavfilter/vf_sr.c
@@ -159,8 +159,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
sws_scale(ctx->sws_uv_scale, (const uint8_t **)(in->data + 2), in->linesize + 2,
0, ctx->sws_uv_height, out->data + 2, out->linesize + 2);
}
-
- av_frame_free(&in);
+ if (in != out) {
+ av_frame_free(&in);
+ }
return ff_filter_frame(outlink, out);
}