From: Igor Mammedov <imammedo@redhat.com>
To: Niek Linnenbank <nieklinnenbank@gmail.com>
Cc: Beniamino Galvani <b.galvani@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>,
drjones@redhat.com, qemu-arm <qemu-arm@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH] hw/arm/cubieboard: make sure SOC object isn't leaked
Date: Fri, 6 Mar 2020 11:06:49 +0100 [thread overview]
Message-ID: <20200306110649.713ee0af@redhat.com> (raw)
In-Reply-To: <CAPan3Wqr8HuXSmZL1DZTSjD_PfcoxNO5FkKAr36rzY8+vyOORg@mail.gmail.com>
On Thu, 5 Mar 2020 21:07:08 +0100
Niek Linnenbank <nieklinnenbank@gmail.com> wrote:
> Hi Igor,
>
[...]
> > + a10 = AW_A10(object_new(TYPE_AW_A10));
> > + object_property_add_child(OBJECT(machine), "soc", OBJECT(a10),
> > + &error_abort);
> > + object_unref(OBJECT(a10));
> >
>
> I see that there are a few machines which also do
> object_property_add_child() to add its
> SoC object to the machine, but they do not do the object_unref(). Can you
> explain why it is needed here?
object_new() returns object with ref == 1, and it's responsibility
of the caller to take care of it.
If caller won't track and call object_unref() eventually on returned pointer,
the object will leak.
(object_unref() destroys object when 'ref' reaches 0 )
> Or do the other machines still have a leak due to the missing
> object_unref()? Examples are:
> hw/arm/sabrelite.c
> hw/arm/mcimx7d-sabre.c
> hw/arm/mcimx6ul-evk.c
>
> Regards,
> Niek
>
>
> > +
> > object_property_set_int(OBJECT(&a10->emac), 1, "phy-addr", &err);
> > if (err != NULL) {
> > error_reportf_err(err, "Couldn't set phy address: ");
> > --
> > 2.18.1
> >
> >
> >
>
next prev parent reply other threads:[~2020-03-06 10:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 9:12 [PATCH] hw/arm/cubieboard: make sure SOC object isn't leaked Igor Mammedov
2020-03-05 20:07 ` Niek Linnenbank
2020-03-06 10:06 ` Igor Mammedov [this message]
2020-03-06 10:33 ` Philippe Mathieu-Daudé
2020-03-06 10:48 ` Igor Mammedov
2020-03-10 19:49 ` Niek Linnenbank
2020-03-12 12:01 ` Peter Maydell
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=20200306110649.713ee0af@redhat.com \
--to=imammedo@redhat.com \
--cc=b.galvani@gmail.com \
--cc=drjones@redhat.com \
--cc=nieklinnenbank@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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.