qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: damien.hedde@greensocs.com, kwolf@redhat.com
Subject: [PATCH] qdev-monitor: Fix use after free on duplicate device ID error
Date: Wed,  3 Nov 2021 08:38:48 +0100	[thread overview]
Message-ID: <20211103073848.1459138-1-armbru@redhat.com> (raw)

Fixes: 4a1d937796de0fecd8b22d7dbebf87f38e8282fd
Reported-by: Coverity CID 1465223
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 softmmu/qdev-monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index e49d9773d2..14c1fb76c5 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -592,8 +592,8 @@ const char *qdev_set_id(DeviceState *dev, char *id, Error **errp)
         if (prop) {
             dev->id = id;
         } else {
-            g_free(id);
             error_setg(errp, "Duplicate device ID '%s'", id);
+            g_free(id);
             return NULL;
         }
     } else {
-- 
2.31.1



             reply	other threads:[~2021-11-03  7:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  7:38 Markus Armbruster [this message]
2021-11-03  7:42 ` [PATCH] qdev-monitor: Fix use after free on duplicate device ID error Marc-André Lureau
2021-11-03  9:25 ` Damien Hedde
2021-11-03  9:33 ` Kevin Wolf

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=20211103073848.1459138-1-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=damien.hedde@greensocs.com \
    --cc=kwolf@redhat.com \
    --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 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).