提交 e4d67e4f 编写于 作者: M Marc-André Lureau

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: NMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: NStefan Weil <sw@weilnetz.de>
Reviewed-by: NJason Wang <jasowang@redhat.com>
Reviewed-by: NRichard Henderson <rth@twiddle.net>
上级 38cc1dba
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册