From e4d67e4f2e06128bc7f07263afe9acc2e2242fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 7 Jun 2017 00:45:43 +0400 Subject: [PATCH] eepro100: replace g_malloc()+memcpy() with g_memdup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I found these pattern via grepping the source tree. I don't have a coccinelle script for it! Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Weil Reviewed-by: Jason Wang Reviewed-by: Richard Henderson --- hw/net/eepro100.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 5a4774aab4..a7b9f77519 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -1904,8 +1904,7 @@ static void e100_nic_realize(PCIDevice *pci_dev, Error **errp) qemu_register_reset(nic_reset, s); - s->vmstate = g_malloc(sizeof(vmstate_eepro100)); - memcpy(s->vmstate, &vmstate_eepro100, sizeof(vmstate_eepro100)); + s->vmstate = g_memdup(&vmstate_eepro100, sizeof(vmstate_eepro100)); s->vmstate->name = qemu_get_queue(s->nic)->model; vmstate_register(&pci_dev->qdev, -1, s->vmstate, s); } -- GitLab