diff mbox series

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

Message ID 20210614175615.15222-1-shubhanshu.e01@gmail.com
State Accepted
Commit 2df963b5fa6784ac6f1413c9b1706c20da66e8df
Headers show
Series [FFmpeg-devel] lavfi/dnn_backend_openvino.c: Fix Memory Leak for RequestItem
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Shubhanshu Saxena June 14, 2021, 5:56 p.m. UTC
Fix memory leak for RequestItem upon error while pushing to the
request_queue in the completion callback.

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

Comments

Guo, Yejun June 18, 2021, 1:43 p.m. UTC | #1
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Shubhanshu Saxena
> Sent: 2021年6月15日 1:56
> To: ffmpeg-devel@ffmpeg.org
> Cc: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
> Subject: [FFmpeg-devel] [PATCH] lavfi/dnn_backend_openvino.c: Fix
> Memory Leak for RequestItem
> 
> Fix memory leak for RequestItem upon error while pushing to the
> request_queue in the completion callback.
> 
> Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@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;
>      }
LGTM, will push soon, thanks.
diff mbox series

Patch

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;
     }