diff mbox series

[FFmpeg-devel,11/23] dnn/dnn_backend_native: Fix leak in case parsing options fails

Message ID 20210310215446.1396386-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 0e078c6cfa078475517cc07a500032a42a523587
Headers show
Series [FFmpeg-devel,1/8] avcodec/cbs: Remove redundant checks for CodedBitstreamContext.codec | expand

Commit Message

Andreas Rheinhardt March 10, 2021, 9:54 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavfilter/dnn/dnn_backend_native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guo, Yejun March 11, 2021, 1:50 a.m. UTC | #1
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> Subject: [FFmpeg-devel] [PATCH 11/23] dnn/dnn_backend_native: Fix leak in
> case parsing options fails
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavfilter/dnn/dnn_backend_native.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native.c
> b/libavfilter/dnn/dnn_backend_native.c
> index 5336cd765a..fd1f9e299d 100644
> --- a/libavfilter/dnn/dnn_backend_native.c
> +++ b/libavfilter/dnn/dnn_backend_native.c
> @@ -157,12 +157,12 @@ DNNModel *ff_dnn_load_model_native(const char
> *model_filename, DNNFunctionType f
>      if (!native_model){
>          goto fail;
>      }
> +    model->model = native_model;
> 
>      native_model->ctx.class = &dnn_native_class;
>      model->options = options;
>      if (av_opt_set_from_string(&native_model->ctx, model->options, NULL,
> "=", "&") < 0)
>          goto fail;
> -    model->model = (void *)native_model;

nice catch, thanks, LGTM.
diff mbox series

Patch

diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c
index 5336cd765a..fd1f9e299d 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -157,12 +157,12 @@  DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f
     if (!native_model){
         goto fail;
     }
+    model->model = native_model;
 
     native_model->ctx.class = &dnn_native_class;
     model->options = options;
     if (av_opt_set_from_string(&native_model->ctx, model->options, NULL, "=", "&") < 0)
         goto fail;
-    model->model = (void *)native_model;
     native_model->model = model;
 
 #if !HAVE_PTHREAD_CANCEL