]> xenbits.xensource.com Git - libvirt.git/commitdiff
report OOM in two places in node_device_driver.c
authorDave Allan <dallan@redhat.com>
Thu, 19 Nov 2009 14:44:00 +0000 (15:44 +0100)
committerDaniel Veillard <veillard@redhat.com>
Thu, 19 Nov 2009 14:44:00 +0000 (15:44 +0100)
* src/node_device/node_device_driver.c: two places where not calling
  virReportOOMError after strdup failure

src/node_device/node_device_driver.c

index cddd9940829f08b020c568a0730c3811ed5f68c4..b474d434e5e8cb66b118b101e915aabbd98e7a11 100644 (file)
@@ -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;