qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] qdev-monitor: Fix use after free on duplicate device ID erro


From: Marc-André Lureau
Subject: Re: [PATCH] qdev-monitor: Fix use after free on duplicate device ID error
Date: Wed, 3 Nov 2021 11:42:07 +0400



On Wed, Nov 3, 2021 at 11:39 AM Markus Armbruster <armbru@redhat.com> wrote:
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



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


--
Marc-André Lureau

reply via email to

[Prev in Thread] Current Thread [Next in Thread]