qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PATCH v2 29/29] eepro100: replace g_malloc()+memcpy() wi


From: Marc-André Lureau
Subject: [Qemu-trivial] [PATCH v2 29/29] eepro100: replace g_malloc()+memcpy() with g_memdup()
Date: Thu, 13 Jul 2017 18:32:19 +0200

I found these pattern via grepping the source tree. I don't have a
coccinelle script for it!

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Stefan Weil <address@hidden>
Reviewed-by: Jason Wang <address@hidden>
---
 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);
 }
-- 
2.13.1.395.gf7b71de06




reply via email to

[Prev in Thread] Current Thread [Next in Thread]