]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
xen_xl: Check for virConfSetValue() retval
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 14 Jan 2022 09:36:42 +0000 (10:36 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 17 Jan 2022 08:53:45 +0000 (09:53 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libxl/xen_xl.c

index 94268fb76d47203e8ab7a468f4877a2e6a9f66ea..e3ddae88270e1bfe705464242a91981133ca87ef 100644 (file)
@@ -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);