avfilter/vf_dnn_detect: Fix null pointer dereference

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
Zhao Zhili 2024-05-08 00:08:18 +08:00 committed by Guo Yejun
parent f7a1453f27
commit 553c572204
1 changed files with 6 additions and 4 deletions

View File

@ -807,11 +807,13 @@ static av_cold void dnn_detect_uninit(AVFilterContext *context)
DnnDetectContext *ctx = context->priv; DnnDetectContext *ctx = context->priv;
AVDetectionBBox *bbox; AVDetectionBBox *bbox;
ff_dnn_uninit(&ctx->dnnctx); ff_dnn_uninit(&ctx->dnnctx);
if (ctx->bboxes_fifo) {
while (av_fifo_can_read(ctx->bboxes_fifo)) { while (av_fifo_can_read(ctx->bboxes_fifo)) {
av_fifo_read(ctx->bboxes_fifo, &bbox, 1); av_fifo_read(ctx->bboxes_fifo, &bbox, 1);
av_freep(&bbox); av_freep(&bbox);
} }
av_fifo_freep2(&ctx->bboxes_fifo); av_fifo_freep2(&ctx->bboxes_fifo);
}
av_freep(&ctx->anchors); av_freep(&ctx->anchors);
free_detect_labels(ctx); free_detect_labels(ctx);
} }