qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tests: check-qom-proplist: fix leak
@ 2017-06-09 13:33 Marc-André Lureau
  2017-06-09 14:58 ` Eric Blake
  2017-07-11  5:27 ` Markus Armbruster
  0 siblings, 2 replies; 5+ messages in thread
From: Marc-André Lureau @ 2017-06-09 13:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: mdroth, armbru, Marc-André Lureau

user_creatable_add_opts() returns a reference (the other reference is
for the root parent/child link).

Leak introduced in commit a1af255f065cc.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/check-qom-proplist.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
index 8e432e9ab6..a3cd7ab29f 100644
--- a/tests/check-qom-proplist.c
+++ b/tests/check-qom-proplist.c
@@ -428,6 +428,8 @@ static void test_dummy_createcmdl(void)
     g_assert(err == NULL);
     error_free(err);
 
+    object_unref(OBJECT(dobj));
+
     /*
      * cmdline-parsing via qemu_opts_parse() results in a QemuOpts entry
      * corresponding to the Object's ID to be added to the QemuOptsList
-- 
2.13.0.91.g00982b8dd

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] tests: check-qom-proplist: fix leak
  2017-06-09 13:33 [Qemu-devel] [PATCH] tests: check-qom-proplist: fix leak Marc-André Lureau
@ 2017-06-09 14:58 ` Eric Blake
  2017-06-09 15:34   ` Markus Armbruster
  2017-07-11  5:27 ` Markus Armbruster
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Blake @ 2017-06-09 14:58 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel; +Cc: mdroth, armbru

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

On 06/09/2017 08:33 AM, Marc-André Lureau wrote:
> user_creatable_add_opts() returns a reference (the other reference is
> for the root parent/child link).
> 
> Leak introduced in commit a1af255f065cc.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/check-qom-proplist.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
> index 8e432e9ab6..a3cd7ab29f 100644
> --- a/tests/check-qom-proplist.c
> +++ b/tests/check-qom-proplist.c
> @@ -428,6 +428,8 @@ static void test_dummy_createcmdl(void)
>      g_assert(err == NULL);
>      error_free(err);
>  
> +    object_unref(OBJECT(dobj));

This should be spelled QDECREF(dobj);

(Hmm - maybe scripts/coccinelle/qobject.cocci should be taught this
cleanup pattern...)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] tests: check-qom-proplist: fix leak
  2017-06-09 14:58 ` Eric Blake
@ 2017-06-09 15:34   ` Markus Armbruster
  2017-06-09 15:42     ` Eric Blake
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Armbruster @ 2017-06-09 15:34 UTC (permalink / raw)
  To: Eric Blake; +Cc: Marc-André Lureau, qemu-devel, mdroth

Eric Blake <eblake@redhat.com> writes:

> On 06/09/2017 08:33 AM, Marc-André Lureau wrote:
>> user_creatable_add_opts() returns a reference (the other reference is
>> for the root parent/child link).
>> 
>> Leak introduced in commit a1af255f065cc.
>> 
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>>  tests/check-qom-proplist.c | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
>> index 8e432e9ab6..a3cd7ab29f 100644
>> --- a/tests/check-qom-proplist.c
>> +++ b/tests/check-qom-proplist.c
>> @@ -428,6 +428,8 @@ static void test_dummy_createcmdl(void)
>>      g_assert(err == NULL);
>>      error_free(err);
>>  
>> +    object_unref(OBJECT(dobj));
>
> This should be spelled QDECREF(dobj);

Caution, this is object_unref(), not qobject_decref().

We suck at naming.

> (Hmm - maybe scripts/coccinelle/qobject.cocci should be taught this
> cleanup pattern...)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] tests: check-qom-proplist: fix leak
  2017-06-09 15:34   ` Markus Armbruster
@ 2017-06-09 15:42     ` Eric Blake
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2017-06-09 15:42 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Marc-André Lureau, qemu-devel, mdroth

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

On 06/09/2017 10:34 AM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
>> On 06/09/2017 08:33 AM, Marc-André Lureau wrote:
>>> user_creatable_add_opts() returns a reference (the other reference is
>>> for the root parent/child link).
>>>
>>> Leak introduced in commit a1af255f065cc.
>>>
>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>> ---
>>>  tests/check-qom-proplist.c | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
>>> index 8e432e9ab6..a3cd7ab29f 100644
>>> --- a/tests/check-qom-proplist.c
>>> +++ b/tests/check-qom-proplist.c
>>> @@ -428,6 +428,8 @@ static void test_dummy_createcmdl(void)
>>>      g_assert(err == NULL);
>>>      error_free(err);
>>>  
>>> +    object_unref(OBJECT(dobj));
>>
>> This should be spelled QDECREF(dobj);
> 
> Caution, this is object_unref(), not qobject_decref().

Indeed - now that I re-read it closely, I see that you are right.  Oh
well - I didn't waste much time improving the qobject coccinelle script,
even though this patch proposal is unrelated to that one. :)

> 
> We suck at naming.

Not the first time.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] tests: check-qom-proplist: fix leak
  2017-06-09 13:33 [Qemu-devel] [PATCH] tests: check-qom-proplist: fix leak Marc-André Lureau
  2017-06-09 14:58 ` Eric Blake
@ 2017-07-11  5:27 ` Markus Armbruster
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2017-07-11  5:27 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, mdroth, qemu-trivial

Copying qemu-trivial.

Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> user_creatable_add_opts() returns a reference (the other reference is
> for the root parent/child link).
>
> Leak introduced in commit a1af255f065cc.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/check-qom-proplist.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
> index 8e432e9ab6..a3cd7ab29f 100644
> --- a/tests/check-qom-proplist.c
> +++ b/tests/check-qom-proplist.c
> @@ -428,6 +428,8 @@ static void test_dummy_createcmdl(void)
>      g_assert(err == NULL);
>      error_free(err);
>  
> +    object_unref(OBJECT(dobj));
> +
>      /*
>       * cmdline-parsing via qemu_opts_parse() results in a QemuOpts entry
>       * corresponding to the Object's ID to be added to the QemuOptsList

Reviewed-by: Markus Armbruster <armbru@redhat.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-11  5:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-09 13:33 [Qemu-devel] [PATCH] tests: check-qom-proplist: fix leak Marc-André Lureau
2017-06-09 14:58 ` Eric Blake
2017-06-09 15:34   ` Markus Armbruster
2017-06-09 15:42     ` Eric Blake
2017-07-11  5:27 ` Markus Armbruster

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).