mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
conf: Fix virNodeDeviceObjGetNames nnames increment
To be safer, only increment nnames after the VIR_STRDUP is successful.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user