[PATCH 03/11] xen_xl: Check for virConfSetValue() retval

Michal Privoznik mprivozn at redhat.com
Fri Jan 14 14:39:47 UTC 2022


There's one case where the return value of virConfSetValue() is
not checked for and it's in xenFormatXLInputDevs() function.
Let's fix that.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/libxl/xen_xl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 94268fb76d..e3ddae8827 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -1853,7 +1853,11 @@ xenFormatXLInputDevs(virConf *conf, virDomainDef *def)
                     goto error;
                 virConfFreeValue(usbdevices);
             } else {
-                virConfSetValue(conf, "usbdevice", usbdevices);
+                if (virConfSetValue(conf, "usbdevice", usbdevices) < 0) {
+                    usbdevices = NULL;
+                    goto error;
+                }
+                usbdevices = NULL;
             }
         } else {
             VIR_FREE(usbdevices);
-- 
2.34.1




More information about the libvir-list mailing list