提交 0fe55374 编写于 作者: D Dave Allan 提交者: Daniel Veillard

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
上级 278e9478
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册