mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
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
This commit is contained in:
parent
278e947890
commit
0fe553744a
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user