summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lalancette <clalance@redhat.com>2008-06-19 10:38:36 +0000
committerChris Lalancette <clalance@redhat.com>2008-06-19 10:38:36 +0000
commita24b1d9eda3c8d9e87653ff6a8f5d8767e188bfc (patch)
treead215479a39f36ea727cba07278cb095c9e5c781
parentremove trailing white space (diff)
downloadlibvirt-a24b1d9eda3c8d9e87653ff6a8f5d8767e188bfc.tar.gz
libvirt-a24b1d9eda3c8d9e87653ff6a8f5d8767e188bfc.tar.bz2
libvirt-a24b1d9eda3c8d9e87653ff6a8f5d8767e188bfc.zip
When doing the conversion to danpb's new memory API, a small bug was
introduced into the qemudNetworkIfaceConnect() function. In particular, there is a call: if (VIR_ALLOC_N(vm->tapfds, vm->ntapfds+2) < 0) goto no_memory; However, the tapfds structure is used to track *all* of the tap fds, and is called once for each network that is being attached to the domain. VIR_ALLOC_N maps to calloc(). So the first network would work just fine, but if you had more than one network, subsequent calls to this function would blow away the stored fd's that were already there and fill them all in with zeros. This causes multiple problems, from the qemu domains not starting properly to improper cleanup on shutdown. The attached patch just changes the VIR_ALLOC_N() to a VIR_REALLOC_N(), and everything is happy again. Signed-off-by: Chris Lalancette <clalance@redhat.com>
-rw-r--r--src/qemu_conf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index f671578e2..17f0162cd 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -2317,7 +2317,7 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
if (!(retval = strdup(tapfdstr)))
goto no_memory;
- if (VIR_ALLOC_N(vm->tapfds, vm->ntapfds+2) < 0)
+ if (VIR_REALLOC_N(vm->tapfds, vm->ntapfds+2) < 0)
goto no_memory;
vm->tapfds[vm->ntapfds++] = tapfd;