tests: check-qom-proplist: fix leak
PATCH 1/1 tests: check-qom-proplist: fix leak
user_creatable_add_opts() returns a reference (the other reference is for the root parent/child link).
Leak introduced in commit a1af255f065cc.
--- tests/check-qom-proplist.c | 2 ++ 1 file changed, 2 insertions(+)
tests/check-qom-proplist.c +2 -0
@@ -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
Signature · 1 line
2.13.0.91.g00982b8dd
Quoted 15 lines · 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 <[email protected]>--- tests/check-qom-proplist.c | 2 ++ 1 file changed, 2 insertions(+)tests/check-qom-proplist.c +0
-0
tests/check-qom-proplist.c static void test_dummy_createcmdl(void) · line 431
Quoted 4 lines
tests/check-qom-proplist.c +1
-0@@ -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...)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 19 lines · Eric Blake
Quoted 18 lines · 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 <[email protected]>--- tests/check-qom-proplist.c | 2 ++ 1 file changed, 2 insertions(+)tests/check-qom-proplist.c +0
-0@@ -428,6 +428,8 @@ static void test_dummy_createcmdl(void)g_assert (err ==NULL );error_free (err);
Quoted 3 lines
tests/check-qom-proplist.c static void test_dummy_createcmdl(void) · line 431
Quoted 1 line
tests/check-qom-proplist.c +1
-0+object_unref (OBJECT (dobj));This should be spelled QDECREF(dobj);
Caution, this is object_unref(), not qobject_decref().
We suck at naming.
Quoted 2 lines
(Hmm - maybe
scripts/coccinelle/qobject.coccishould be taught this cleanup pattern...)
Quoted 21 lines · Markus Armbruster
Quoted 19 lines · Eric Blake
Quoted 18 lines · 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 <[email protected]>--- tests/check-qom-proplist.c | 2 ++ 1 file changed, 2 insertions(+)tests/check-qom-proplist.c +0
-0@@ -428,6 +428,8 @@ static void test_dummy_createcmdl(void)g_assert (err ==NULL );error_free (err);
Quoted 5 lines
Quoted 3 lines
tests/check-qom-proplist.c static void test_dummy_createcmdl(void) · line 431
Quoted 1 line
tests/check-qom-proplist.c +1
-0+object_unref (OBJECT (dobj));This should be spelled QDECREF(dobj);
Caution, this is
object_unref(), notqobject_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. :)
Quoted 2 lines
We suck at naming.
Not the first time.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Copying qemu-trivial.
Quoted 15 lines · 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 <[email protected]>--- tests/check-qom-proplist.c | 2 ++ 1 file changed, 2 insertions(+)tests/check-qom-proplist.c +0
-0
tests/check-qom-proplist.c static void test_dummy_createcmdl(void) · line 435
Quoted 8 lines
tests/check-qom-proplist.c +2
-0@@ -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