Commit 9bd3bdd6ba for qemu.org
commit 9bd3bdd6bab33c84c9e239f47806677ff906b4a0
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Tue Feb 24 15:53:57 2026 +0100
ui/vnc: VncDisplay.id is not const
s/strdup/g_strdup to highlight the issue and be consistent with other
allocations.
The next patch is going to introduce vnc_display_free() to take care of
deallocating it.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
diff --git a/ui/vnc.c b/ui/vnc.c
index 23af83fd6c..d5d92c0d99 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3433,7 +3433,7 @@ void vnc_display_init(const char *id, Error **errp)
}
vd = g_malloc0(sizeof(*vd));
- vd->id = strdup(id);
+ vd->id = g_strdup(id);
QTAILQ_INSERT_TAIL(&vnc_displays, vd, next);
QTAILQ_INIT(&vd->clients);
diff --git a/ui/vnc.h b/ui/vnc.h
index ec8d0c91b5..c5d678ac31 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -166,7 +166,7 @@ struct VncDisplay
pixman_image_t *server; /* vnc server surface */
int true_width; /* server surface width before rounding up */
- const char *id;
+ char *id;
QTAILQ_ENTRY(VncDisplay) next;
char *password;
time_t expires;