All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Chandan Somani <csomani@redhat.com>
Cc: qemu-devel@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Yoshinori Sato" <yoshinori.sato@nifty.com>,
	"Jiri Pirko" <jiri@resnulli.us>,
	"Jason Wang" <jasowang@redhat.com>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"open list:Block layer core" <qemu-block@nongnu.org>,
	"open list:Stellaris" <qemu-arm@nongnu.org>
Subject: Re: [PATCH] qdev: Free property array on release
Date: Tue, 6 Jan 2026 15:30:18 -0500	[thread overview]
Message-ID: <20260106203018.GE123256@fedora> (raw)
In-Reply-To: <20251222055009.1050567-1-csomani@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 974 bytes --]

On Sun, Dec 21, 2025 at 09:50:05PM -0800, Chandan Somani wrote:
> @@ -686,14 +684,16 @@ static void release_prop_array(Object *obj, const char *name, void *opaque)
>      char *elem = *arrayptr;
>      int i;
>  
> -    if (!prop->arrayinfo->release) {
> -        return;
> +    if (prop->arrayinfo->release) {
> +        for (i = 0; i < *alenptr; i++) {
> +            Property elem_prop = array_elem_prop(obj, prop, name, elem);
> +            prop->arrayinfo->release(obj, NULL, &elem_prop);
> +            elem += prop->arrayfieldsize;
> +        }
>      }
>  
> -    for (i = 0; i < *alenptr; i++) {
> -        Property elem_prop = array_elem_prop(obj, prop, name, elem);
> -        prop->arrayinfo->release(obj, NULL, &elem_prop);
> -        elem += prop->arrayfieldsize;
> +    if (*arrayptr) {
> +        g_free(*arrayptr);
>      }

Optional cleanup to protect against use-after-free and similar issues:

*arrayptr = NULL;
*alenptr = 0;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2026-01-07 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-22  5:50 [PATCH] qdev: Free property array on release Chandan Somani
2026-01-06 20:24 ` Stefan Hajnoczi
2026-01-06 20:30 ` Stefan Hajnoczi [this message]
2026-01-07 16:31   ` Daniel P. Berrangé
2026-01-08  8:31 ` Marc-André Lureau

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=20260106203018.GE123256@fedora \
    --to=stefanha@redhat.com \
    --cc=alistair@alistair23.me \
    --cc=berrange@redhat.com \
    --cc=csomani@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=hreitz@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yoshinori.sato@nifty.com \
    /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.