提交 44d3db97 编写于 作者: J John Ferlan

conf: Fix virNodeDeviceObjGetNames nnames increment

To be safer, only increment nnames after the VIR_STRDUP is successful.
上级 fd6e3f48
......@@ -512,10 +512,11 @@ virNodeDeviceObjGetNames(virNodeDeviceObjListPtr devs,
virNodeDeviceObjLock(obj);
if (aclfilter && aclfilter(conn, obj->def) &&
(!cap || virNodeDeviceObjHasCap(obj, cap))) {
if (VIR_STRDUP(names[nnames++], obj->def->name) < 0) {
if (VIR_STRDUP(names[nnames], obj->def->name) < 0) {
virNodeDeviceObjUnlock(obj);
goto failure;
}
nnames++;
}
virNodeDeviceObjUnlock(obj);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册