system/ioport: minor code simplification

Drop needless memset() and replace g_malloc0() with g_new().

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau committed 2026-06-06 09:15:23 +04:00
1 parent 1f98385132
commit d31a0ebfc8
1 file changed
+1 -2
+1 -2
View File
@@ -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) {