qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexander Bulekov <alxndr@bu.edu>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH] pc: fix leak in pc_system_flash_cleanup_unused
Date: Wed, 1 Jul 2020 16:18:37 +0200	[thread overview]
Message-ID: <d3de8d7e-3a11-106d-c0c8-33015813ef6c@redhat.com> (raw)
In-Reply-To: <20200701130620.cldkfygyhz6oscev@mozz.bu.edu>

On 01/07/20 15:06, Alexander Bulekov wrote:
>> Yes; you can also add it in pc_pflash_create, because
>>
>>     /*
>>      * Since object_property_add_child added a reference to the child object,
>>      * we can drop the reference added by object_initialize(), so the child
>>      * property will own the only reference to the object.
>>      */
>>
>> (from object_initialize_childv).
> Isn't that reference used at pc_sysfw.c:104 ?
> pcms->flash[0] = pc_pflash_create(pcms, "system.flash0", "pflash0");
> 
> In this case, shouldn't we unref when
> pc_sysfw.c:126  pcms->flash[0] = NULL
> ?

object_unparent already drops a reference.  Therefore, it's okay to drop
the reference immediately after object_property_add_child (which adds a
reference) and match pc_pflash_create with just object_unparent.

Paolo



  reply	other threads:[~2020-07-01 14:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01  1:58 [PATCH] pc: fix leak in pc_system_flash_cleanup_unused Alexander Bulekov
2020-07-01  5:49 ` Paolo Bonzini
2020-07-01 13:06   ` Alexander Bulekov
2020-07-01 14:18     ` Paolo Bonzini [this message]
2020-07-01  7:34 ` Philippe Mathieu-Daudé

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=d3de8d7e-3a11-106d-c0c8-33015813ef6c@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alxndr@bu.edu \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).