diff --git a/net.c b/net.c index 76e44c9c98a4de52aefc29ed0c8d5105fbebb8eb..f2b472d5c61bf60a525c1956b60f72a2bf61ef26 100644 --- a/net.c +++ b/net.c @@ -2443,6 +2443,7 @@ int net_client_init(Monitor *mon, const char *device, const char *p) goto out; } nd = &nd_table[idx]; + memset(nd, 0, sizeof(*nd)); macaddr = nd->macaddr; macaddr[0] = 0x52; macaddr[1] = 0x54; @@ -2818,7 +2819,7 @@ void net_client_uninit(NICInfo *nd) qemu_free(nd->devaddr); qemu_free(nd->id); - memset(nd, 0, sizeof(*nd)); + nd->used = 0; } static int net_host_check_device(const char *device)