[FFmpeg-cvslog] avfilter/vf_dnn_detect: Fix null pointer dereference
Zhao Zhili
git at videolan.org
Tue May 21 14:01:07 EEST 2024
ffmpeg | branch: master | Zhao Zhili <zhilizhao at tencent.com> | Wed May 8 00:08:18 2024 +0800| [553c572204392f7a74bbfebcf3d33f1161976c8b] | committer: Guo Yejun
avfilter/vf_dnn_detect: Fix null pointer dereference
Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=553c572204392f7a74bbfebcf3d33f1161976c8b
---
libavfilter/vf_dnn_detect.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c
index 926966368a..1830bae181 100644
--- a/libavfilter/vf_dnn_detect.c
+++ b/libavfilter/vf_dnn_detect.c
@@ -807,11 +807,13 @@ static av_cold void dnn_detect_uninit(AVFilterContext *context)
DnnDetectContext *ctx = context->priv;
AVDetectionBBox *bbox;
ff_dnn_uninit(&ctx->dnnctx);
- while(av_fifo_can_read(ctx->bboxes_fifo)) {
- av_fifo_read(ctx->bboxes_fifo, &bbox, 1);
- av_freep(&bbox);
+ if (ctx->bboxes_fifo) {
+ while (av_fifo_can_read(ctx->bboxes_fifo)) {
+ av_fifo_read(ctx->bboxes_fifo, &bbox, 1);
+ av_freep(&bbox);
+ }
+ av_fifo_freep2(&ctx->bboxes_fifo);
}
- av_fifo_freep2(&ctx->bboxes_fifo);
av_freep(&ctx->anchors);
free_detect_labels(ctx);
}
More information about the ffmpeg-cvslog
mailing list