mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
conf: Fix virNodeDeviceObjGetNames nnames increment
To be safer, only increment nnames after the VIR_STRDUP is successful.
This commit is contained in:
parent
fd6e3f48ed
commit
44d3db9785
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user