aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-07 00:45:43 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-08-31 12:29:07 +0200
commite4d67e4f2e06128bc7f07263afe9acc2e2242fdc (patch)
treea32722c86b163ba1be089f9b26c3ad8f70cf98a8
parent38cc1dba1fd3a906ecf8384f592b2d4952b0e43c (diff)
downloadqemu-e4d67e4f2e06128bc7f07263afe9acc2e2242fdc.zip
qemu-e4d67e4f2e06128bc7f07263afe9acc2e2242fdc.tar.gz
qemu-e4d67e4f2e06128bc7f07263afe9acc2e2242fdc.tar.bz2
eepro100: replace g_malloc()+memcpy() with g_memdup()
I found these pattern via grepping the source tree. I don't have a coccinelle script for it! Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
-rw-r--r--hw/net/eepro100.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
index 5a4774a..a7b9f77 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);
}