libxlMakeDomBuildInfo: Don't use VIR_DISPOSE_N for USB device list

The list isn't secret which would need being disposed of. Just expand
the array and return failure when adding the NULL terminator similarly
to how we expand the list for adding devices in a loop.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Peter Krempa 2021-02-01 12:12:42 +01:00
parent 9c9423a1e8
commit b57b6b4eea

View File

@ -686,7 +686,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
/* NULL-terminate usbdevice_list */
if (nusbdevice > 0 &&
VIR_EXPAND_N(b_info->u.hvm.usbdevice_list, nusbdevice, 1) < 0) {
VIR_DISPOSE_N(b_info->u.hvm.usbdevice_list, nusbdevice);
return -1;
}
#endif