[PATCH v2 02/27] libxlMakeDomBuildInfo: Don't use VIR_DISPOSE_N for USB device list

Peter Krempa posted 27 patches 5 years ago
[PATCH v2 02/27] libxlMakeDomBuildInfo: Don't use VIR_DISPOSE_N for USB device list
Posted by Peter Krempa 5 years ago
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>
---
 src/libxl/libxl_conf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 6a8ae27f54..cb1fd7df7d 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -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
-- 
2.29.2

Re: [PATCH v2 02/27] libxlMakeDomBuildInfo: Don't use VIR_DISPOSE_N for USB device list
Posted by Daniel P. Berrangé 5 years ago
On Tue, Feb 02, 2021 at 05:55:39PM +0100, Peter Krempa wrote:
> 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>
> ---
>  src/libxl/libxl_conf.c | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|