From: Dave Allan Date: Thu, 19 Nov 2009 14:44:00 +0000 (+0100) Subject: report OOM in two places in node_device_driver.c X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0fe553744a9b4bf98db7753e48db3ff83af856ec;p=libvirt.git report OOM in two places in node_device_driver.c * src/node_device/node_device_driver.c: two places where not calling virReportOOMError after strdup failure --- diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index cddd994082..b474d434e5 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;