[FFmpeg-devel] [PATCH] lavfi/dnn_backend_openvino.c: Fix Memory Leak for RequestItem

Shubhanshu Saxena shubhanshu.e01 at gmail.com
Mon Jun 14 20:56:16 EEST 2021


Fix memory leak for RequestItem upon error while pushing to the
request_queue in the completion callback.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01 at gmail.com>
---
 libavfilter/dnn/dnn_backend_openvino.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 709a772a4d..702c4fb9ee 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -293,6 +293,8 @@ static void infer_completion_callback(void *args)
 
     request->inference_count = 0;
     if (ff_safe_queue_push_back(requestq, request) < 0) {
+        ie_infer_request_free(&request->infer_request);
+        av_freep(&request);
         av_log(ctx, AV_LOG_ERROR, "Failed to push back request_queue.\n");
         return;
     }
-- 
2.25.1



More information about the ffmpeg-devel mailing list