I noticed that there are two places in node_device_driver.c in which we don't call virReportOOMError after strdup failure. The attached small patch adds the two calls.

Dave
diff --git a/src/node_device/node_device_driver.c 
b/src/node_device/node_device_driver.c
index cddd994..b474d43 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -175,6 +175,7 @@ nodeListDevices(virConnectPtr conn,
             virNodeDeviceHasCap(driver->devs.objs[i], cap)) {
             if ((names[ndevs++] = strdup(driver->devs.objs[i]->def->name)) == 
NULL) {
                 virNodeDeviceObjUnlock(driver->devs.objs[i]);
+                virReportOOMError(conn);
                 goto failure;
             }
         }
@@ -379,8 +380,10 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const 
names, int maxnames)

     for (caps = obj->def->caps; caps && ncaps < maxnames; caps = caps->next) {
         names[ncaps] = strdup(virNodeDevCapTypeToString(caps->type));
-        if (names[ncaps++] == NULL)
+        if (names[ncaps++] == NULL) {
+            virReportOOMError(dev->conn);
             goto cleanup;
+        }
     }
     ret = ncaps;

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to