@samitouri / QOSamiQemu / commits / 9bd3bdd6ba

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>

Marc-André Lureau committed Feb 24, 2026 at 15:53 UTC 9bd3bdd6bab33c84c9e239f47806677ff906b4a0
2 files changed +2 -2
ui/vnc.c
+1 -1
@@ -3433,7 +3433,7 @@ void vnc_display_init(const char *id, Error **errp)
3433 }
3434 vd = g_malloc0(sizeof(*vd));
3435
3436 - vd->id = strdup(id);
3436 + vd->id = g_strdup(id);
3437 QTAILQ_INSERT_TAIL(&vnc_displays, vd, next);
3438
3439 QTAILQ_INIT(&vd->clients);
ui/vnc.h
+1 -1
@@ -166,7 +166,7 @@ struct VncDisplay
166 pixman_image_t *server; /* vnc server surface */
167 int true_width; /* server surface width before rounding up */
168
169 - const char *id;
169 + char *id;
170 QTAILQ_ENTRY(VncDisplay) next;
171 char *password;
172 time_t expires;