aboutsummaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-10-06 12:16:54 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-06 14:36:10 -0500
commitd2cffe303e3d0a40146c5edf672485cd804cef20 (patch)
tree13de88b49285d60a17d6f313b0e1fad3dead514e /net.c
parent9203f5202bf4bc7e4669ba19d3e6aac7761bd385 (diff)
Move memset() from net_client_uninit() to net_client_init()
zeroing a structure before using it is more common than zeroing after using it. Also makes the setting of nd->used more obvious. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net.c')
-rw-r--r--net.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net.c b/net.c
index 76e44c9c98..f2b472d5c6 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)