| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 2/2] tools/python: Fix memory leak on error path
 
> On 8 Jun 2023, at 14:59, Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
> 
> Commit 56a7aaa16bfe introduced a memory leak on the error path for a
> Py_BuildValue built object that on some newly introduced error path
> has not the correct reference count handling, fix that by decrementing
> the refcount in these path.
> 
> Fixes: 56a7aaa16bfe ("tools: add physinfo arch_capabilities handling for Arm")
> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
> Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
Hi all,
Is there any chance to have this one reviewed by the end of the month?
I’m asking because I have a Jira task attached to this patch and my PM is 
chasing me :)
If it’s not possible it’s fine either and I’ll have just to report that.
Cheers,
Luca
> tools/python/xen/lowlevel/xc/xc.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/python/xen/lowlevel/xc/xc.c 
> b/tools/python/xen/lowlevel/xc/xc.c
> index e14e223ec903..d3ea350e07b9 100644
> --- a/tools/python/xen/lowlevel/xc/xc.c
> +++ b/tools/python/xen/lowlevel/xc/xc.c
> @@ -919,11 +919,16 @@ static PyObject *pyxc_physinfo(XcObject *self)
>         sve_vl_bits = arch_capabilities_arm_sve(pinfo.arch_capabilities);
>         py_arm_sve_vl = PyLong_FromUnsignedLong(sve_vl_bits);
> 
> -        if ( !py_arm_sve_vl )
> +        if ( !py_arm_sve_vl ) {
> +            Py_DECREF(objret);
>             return NULL;
> +        }
> 
> -        if( PyDict_SetItemString(objret, "arm_sve_vl", py_arm_sve_vl) )
> +        if( PyDict_SetItemString(objret, "arm_sve_vl", py_arm_sve_vl) ) {
> +            Py_DECREF(py_arm_sve_vl);
> +            Py_DECREF(objret);
>             return NULL;
> +        }
>     }
> #endif
> 
> -- 
> 2.34.1
> 
> 
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |