[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] tools/python: Fix memory leak on error path


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Thu, 22 Jun 2023 09:17:57 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yTjSkr3n/T3ri/NdMKah3oBnCnAw955m4HsRV40jRI0=; b=lCrxe72Nf90yrgZKQ0REZfBEaMlzK5MnRZsYgSdPdHIt3O7fUER1mGjuCRzI/Eu7dAyRqzDDnk7BN6rYYcBeeyuHIclapVVgxsqPQVqaQIyuIVM7IEtevO0BI/b10mQhH+EUPZSEFOsw/sVNHf6Sy1IxQ7yews615tOio8jSWaPVFuIjheYs5BhYvuFY/T7PHBYFTgbiAdxfU4za+EN3KB0ryS5DNiTIRykDEXbHJP5yVgXrFtlFW+Yth4wkyZZwnwqbojONjFsONSVZoOtg5JffhO0BIrCH/BkWs/b4KnCeRZR5OpzBygNqdIH/A5ZA8Eqo6EpdYocYwWcEHbyxtQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=imTWhGmaLfzGNai8Odvv252jYSSlsIVNizAIl+CYrVtKS4+xD4iIl+2hm1EbDlet3l+yGhUZ5ZY0mS38gC9ncBQTPg20AY02uzSzOvp0+ozB7hAYa5ieL6YzYDM7tS8eDnRYNIf+2emeriFLSac2iRlE8PTWak1MEqikX5GsHpXL0sftz/ahAS45ydmeSYlByYrjweApYsc7iAsKSx5DirYVuvtUA7/DLcIf5uEf73jLDA2fjeVbKD7F2oJqyr8H/f25+AkqucHcmcib9oWnFv0SQpxXS6TfxMYYGIh0l+Q0dUnwEbN86UGmEY/l0BpUKPQWURmeJNN8ErEF8WbOXQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 22 Jun 2023 09:18:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZmhGBKe4OoL9s40qPc71ZQnCAd6+WoK6A
  • Thread-topic: [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
> 
> 


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.