diff mbox

[FFmpeg-devel,6/8] lavfi/vf_deshake_opencl: Fix use of uninitialised variable in error case

Message ID 20190929164605.20835-6-sw@jkqxz.net
State New
Headers show

Commit Message

Mark Thompson Sept. 29, 2019, 4:46 p.m. UTC
Fixes CID 1452756 and 1452757.
---
 libavfilter/vf_deshake_opencl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

James Almer Sept. 29, 2019, 7:56 p.m. UTC | #1
On 9/29/2019 1:46 PM, Mark Thompson wrote:
> Fixes CID 1452756 and 1452757.
> ---
>  libavfilter/vf_deshake_opencl.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/vf_deshake_opencl.c b/libavfilter/vf_deshake_opencl.c
> index c959f19475..c914a77d83 100644
> --- a/libavfilter/vf_deshake_opencl.c
> +++ b/libavfilter/vf_deshake_opencl.c
> @@ -1128,7 +1128,7 @@ static int deshake_opencl_init(AVFilterContext *avctx)
>      AVFilterLink *inlink = avctx->inputs[0];
>      // Pointer to the host-side pattern buffer to be initialized and then copied
>      // to the GPU
> -    PointPair *pattern_host;
> +    PointPair *pattern_host = NULL;
>      cl_int cle;
>      int err;
>      cl_ulong8 zeroed_ulong8;
> @@ -1348,8 +1348,7 @@ static int deshake_opencl_init(AVFilterContext *avctx)
>      return 0;
>  
>  fail:
> -    if (!pattern_host)
> -        av_freep(&pattern_host);
> +    av_freep(&pattern_host);

You're also fixing a leak here. The buffer was never being freed.

>      return err;
>  }
>  
>
diff mbox

Patch

diff --git a/libavfilter/vf_deshake_opencl.c b/libavfilter/vf_deshake_opencl.c
index c959f19475..c914a77d83 100644
--- a/libavfilter/vf_deshake_opencl.c
+++ b/libavfilter/vf_deshake_opencl.c
@@ -1128,7 +1128,7 @@  static int deshake_opencl_init(AVFilterContext *avctx)
     AVFilterLink *inlink = avctx->inputs[0];
     // Pointer to the host-side pattern buffer to be initialized and then copied
     // to the GPU
-    PointPair *pattern_host;
+    PointPair *pattern_host = NULL;
     cl_int cle;
     int err;
     cl_ulong8 zeroed_ulong8;
@@ -1348,8 +1348,7 @@  static int deshake_opencl_init(AVFilterContext *avctx)
     return 0;
 
 fail:
-    if (!pattern_host)
-        av_freep(&pattern_host);
+    av_freep(&pattern_host);
     return err;
 }