From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Luca Fancellu <luca.fancellu@arm.com>
Cc: xen-devel@lists.xenproject.org, bertrand.marquis@arm.com,
wei.chen@arm.com, Wei Liu <wl@xen.org>,
Anthony PERARD <anthony.perard@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH 2/2] tools/python: Fix memory leak on error path
Date: Mon, 26 Jun 2023 20:07:46 +0200 [thread overview]
Message-ID: <ZJnT8rdnMT5lrR0A@mail-itl> (raw)
In-Reply-To: <20230608135913.560413-2-luca.fancellu@arm.com>
[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]
On Thu, Jun 08, 2023 at 02:59:13PM +0100, Luca Fancellu 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@arm.com>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> 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
>
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-06-26 18:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 13:59 [PATCH 1/2] tools: Fix ifdef for aarch64 that should include also arm Luca Fancellu
2023-06-08 13:59 ` [PATCH 2/2] tools/python: Fix memory leak on error path Luca Fancellu
2023-06-22 9:17 ` Luca Fancellu
2023-06-26 18:07 ` Marek Marczykowski-Górecki [this message]
2023-06-27 12:29 ` Marek Marczykowski-Górecki
2023-06-27 17:21 ` Julien Grall
2023-06-22 9:17 ` [PATCH 1/2] tools: Fix ifdef for aarch64 that should include also arm Luca Fancellu
2023-06-26 18:52 ` Marek Marczykowski-Górecki
2023-07-04 9:42 ` Anthony PERARD
2023-07-04 19:11 ` Julien Grall
2023-07-05 6:26 ` Luca Fancellu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZJnT8rdnMT5lrR0A@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=luca.fancellu@arm.com \
--cc=wei.chen@arm.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.