From: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> [PMD: renamed 'Graphics' -> ui/vnc, added ui/vnc.c and ui/vnc-palette.c] --- ui/vnc-enc-tight.c | 2 +- ui/vnc-palette.c | 2 +- ui/vnc.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index f38aceb4da..48ec584098 100644 --- a/ui/vnc-enc-tight.c +++ b/ui/vnc-enc-tight.c @@ -1475,7 +1475,7 @@ static int send_sub_rect(VncState *vs, int x, int y, int w, int h) #endif if (!color_count_palette) { - color_count_palette = g_malloc(sizeof(VncPalette)); + color_count_palette = g_new(VncPalette, 1); vnc_tight_cleanup_notifier.notify = vnc_tight_cleanup; qemu_thread_atexit_add(&vnc_tight_cleanup_notifier); } diff --git a/ui/vnc-palette.c b/ui/vnc-palette.c index dc7c0ba997..284e118715 100644 --- a/ui/vnc-palette.c +++ b/ui/vnc-palette.c @@ -56,7 +56,7 @@ VncPalette *palette_new(size_t max, int bpp) { VncPalette *palette; - palette = g_malloc0(sizeof(*palette)); + palette = g_new0(VncPalette, 1); palette_init(palette, max, bpp); return palette; } diff --git a/ui/vnc.c b/ui/vnc.c index 9f8d5a1b1f..b021fb398b 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -231,7 +231,7 @@ static VncServerInfo *vnc_server_info_get(VncDisplay *vd) return NULL; } - info = g_malloc0(sizeof(*info)); + info = g_new0(VncServerInfo, 1); vnc_init_basic_info_from_server_addr(vd->lsock[0], qapi_VncServerInfo_base(info), &err); info->has_auth = true; @@ -316,7 +316,7 @@ static VncClientInfo *qmp_query_vnc_client(const VncState *client) VncClientInfo *info; Error *err = NULL; - info = g_malloc0(sizeof(*info)); + info = g_new0(VncClientInfo, 1); vnc_init_basic_info_from_remote_addr(client->sioc, qapi_VncClientInfo_base(info), @@ -3047,7 +3047,7 @@ void vnc_display_init(const char *id) if (vnc_display_find(id) != NULL) { return; } - vd = g_malloc0(sizeof(*vd)); + vd = g_new0(VncDisplay, 1); vd->id = strdup(id); QTAILQ_INSERT_TAIL(&vnc_displays, vd, next); -- 2.14.2