From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [PATCH for-5.0 3/3] object-add: don't create return value if failed
Date: Wed, 25 Mar 2020 19:47:23 +0100 [thread overview]
Message-ID: <20200325184723.2029630-4-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20200325184723.2029630-1-marcandre.lureau@redhat.com>
If object-add failed, no need to create a return value that may later
be leaked.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
qom/qom-qmp-cmds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
index 435193b036..6bd137ccbf 100644
--- a/qom/qom-qmp-cmds.c
+++ b/qom/qom-qmp-cmds.c
@@ -287,8 +287,8 @@ void qmp_object_add(QDict *qdict, QObject **ret_data, Error **errp)
visit_free(v);
if (obj) {
object_unref(obj);
+ *ret_data = QOBJECT(qdict_new());
}
- *ret_data = QOBJECT(qdict_new());
}
void qmp_object_del(const char *id, Error **errp)
--
2.26.0.rc2.42.g98cedd0233
next prev parent reply other threads:[~2020-03-25 18:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 18:47 [PATCH for-5.0 0/3] Memory leak fixes Marc-André Lureau
2020-03-25 18:47 ` [PATCH for-5.0 1/3] migration: fix cleanup_bh leak on resume Marc-André Lureau
2020-03-26 2:40 ` Juan Quintela
2020-03-25 18:47 ` [PATCH for-5.0 2/3] qmp: fix leak on callbacks that return both value and error Marc-André Lureau
2020-03-30 14:59 ` Markus Armbruster
2020-03-25 18:47 ` Marc-André Lureau [this message]
2020-03-25 20:43 ` [PATCH for-5.0 3/3] object-add: don't create return value if failed Philippe Mathieu-Daudé
2020-03-26 9:42 ` Paolo Bonzini
2020-03-30 14:48 ` Markus Armbruster
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=20200325184723.2029630-4-marcandre.lureau@redhat.com \
--to=marcandre.lureau@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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 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).