From: Ryota Ozaki Date: Mon, 18 Nov 2013 15:39:55 +0000 (+0900) Subject: vbox: fix segfault on virsh dumpxml with the existence of USB filters X-Git-Tag: v1.2.0-rc1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8229e33adc3d8ed71a3d5864fd10cce2ec6895a6;p=thirdparty%2Flibvirt.git vbox: fix segfault on virsh dumpxml with the existence of USB filters A USB filter is stored in a hostdev. The original code doesn't allocate hostdev->info that is expected to be allocated with hostdev. So use virDomainHostdevDefAlloc() to allocate both as we expect. Signed-off-by: Ryota Ozaki --- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 3807a6d816..f4cd5cfc2e 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -3333,7 +3333,8 @@ sharedFoldersCleanup: deviceFilter->vtbl->GetActive(deviceFilter, &active); if (active) { - if (VIR_ALLOC(def->hostdevs[USBFilterCount]) >= 0) { + def->hostdevs[USBFilterCount] = virDomainHostdevDefAlloc(); + if (def->hostdevs[USBFilterCount]) { PRUnichar *vendorIdUtf16 = NULL; char *vendorIdUtf8 = NULL; unsigned vendorId = 0;