mirror of
https://github.com/qemu/qemu.git
synced 2024-12-01 07:43:35 +08:00
softmmu/qdev-monitor: fix use-after-free in qdev_set_id()
Reported by Coverity (CID 1465222).
Fixes: 4a1d937796
("softmmu/qdev-monitor: add error handling in qdev_set_id")
Cc: Damien Hedde <damien.hedde@greensocs.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20211102163342.31162-1-stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
cd523a4181
commit
b66cecb238
@ -593,8 +593,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 {
|
||||
|
Loading…
Reference in New Issue
Block a user