From d31a0ebfc80b8a36dcdd6eba3d911231c27e0a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 4 May 2026 10:32:07 +0400 Subject: [PATCH] system/ioport: minor code simplification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drop needless memset() and replace g_malloc0() with g_new(). Reviewed-by: Daniel P. Berrangé Signed-off-by: Marc-André Lureau --- system/ioport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/system/ioport.c b/system/ioport.c index 1a0e01fd06..0a1b80f299 100644 --- a/system/ioport.c +++ b/system/ioport.c @@ -230,9 +230,8 @@ static void portio_list_add_1(PortioList *piolist, mrpio = MEMORY_REGION_PORTIO_LIST( object_new(TYPE_MEMORY_REGION_PORTIO_LIST)); mrpio->portio_opaque = piolist->opaque; - mrpio->ports = g_malloc0(sizeof(MemoryRegionPortio) * (count + 1)); + mrpio->ports = g_new0(MemoryRegionPortio, count + 1); memcpy(mrpio->ports, pio_init, sizeof(MemoryRegionPortio) * count); - memset(mrpio->ports + count, 0, sizeof(MemoryRegionPortio)); /* Adjust the offsets to all be zero-based for the region. */ for (i = 0; i < count; ++i) {