[libvirt] [Patch] Fix vcpupin to inactive domains on Xend3.0.3.
Daniel Veillard
veillard at redhat.com
Tue Apr 14 10:42:49 UTC 2009
On Tue, Apr 14, 2009 at 04:41:50PM +0900, Takahashi Tomohiro wrote:
> Hi,
>
> I made the patch that corrected the following problem.
> It is that when I execute the "virsh vcpupin" command to inactive
> domains on Xend3.0.3,
> Libvirt outputs the following Segmentation fault.
>
> # virsh vcpupin guest_dom 0 0,1,2
> Segmentation fault
Yup there is a bug there, but the patch is wrong, it will lead to a
memory leak instead of fixing the real problem which is that
virDomainCpuSetParse() override the mapstr pointer, and the VIR_FREE
is being passed the wrong pointer.
The following patch fixes the problem for me,
thanks,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
-------------- next part --------------
Index: src/xm_internal.c
===================================================================
RCS file: /data/cvs/libxen/src/xm_internal.c,v
retrieving revision 1.123
diff -u -r1.123 xm_internal.c
--- src/xm_internal.c 3 Apr 2009 12:38:52 -0000 1.123
+++ src/xm_internal.c 14 Apr 2009 10:40:25 -0000
@@ -1624,7 +1624,7 @@
const char *filename;
xenXMConfCachePtr entry;
virBuffer mapbuf = VIR_BUFFER_INITIALIZER;
- char *mapstr = NULL;
+ char *mapstr = NULL, *mapsave = NULL;
int i, j, n, comma = 0;
int ret = -1;
char *cpuset = NULL;
@@ -1679,6 +1679,7 @@
}
mapstr = virBufferContentAndReset(&mapbuf);
+ mapsave = mapstr;
if (VIR_ALLOC_N(cpuset, maxcpu) < 0) {
virReportOOMError(domain->conn);
@@ -1700,7 +1701,7 @@
ret = 0;
cleanup:
- VIR_FREE(mapstr);
+ VIR_FREE(mapsave);
VIR_FREE(cpuset);
xenUnifiedUnlock(priv);
return (ret);
More information about the libvir-list
mailing list