mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
Replace virNodeDeviceFree with virObjectUnref
Since virNodeDeviceFree will call virObjectUnref anyway, let's just use that directly so as to avoid the possibility that we inadvertently clear out a pending error message when using the public API.
This commit is contained in:
parent
121c09a90b
commit
e3b456de0f
4
cfg.mk
4
cfg.mk
@ -992,7 +992,7 @@ sc_prohibit_system_error_with_vir_err:
|
||||
# functions. There's a corresponding exclude to allow usage within tests,
|
||||
# docs, examples, tools, src/libvirt-*.c, and include/libvirt/libvirt-*.h
|
||||
sc_prohibit_virXXXFree:
|
||||
@prohibit='\bvir(Domain|Network)Free\b' \
|
||||
@prohibit='\bvir(Domain|Network|NodeDevice)Free\b' \
|
||||
exclude='sc_prohibit_virXXXFree' \
|
||||
halt='avoid using 'virXXXFree', use 'virObjectUnref' instead' \
|
||||
$(_sc_search_regexp)
|
||||
@ -1186,4 +1186,4 @@ exclude_file_name_regexp--sc_prohibit_devname = \
|
||||
^(tools/virsh.pod|cfg.mk|docs/.*)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_virXXXFree = \
|
||||
^(docs/|tests/|examples/|tools/|cfg.mk|src/libvirt_public.syms|include/libvirt/libvirt-(domain|network).h|src/libvirt-(domain|qemu|network).c$$)
|
||||
^(docs/|tests/|examples/|tools/|cfg.mk|src/libvirt_public.syms|include/libvirt/libvirt-(domain|network|nodedev).h|src/libvirt-(domain|qemu|network|nodedev).c$$)
|
||||
|
@ -3375,8 +3375,7 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (dev)
|
||||
virNodeDeviceFree(dev);
|
||||
virObjectUnref(dev);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -4908,7 +4907,7 @@ remoteDispatchConnectListAllNodeDevices(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetMessageSaveError(rerr);
|
||||
if (devices && ndevices > 0) {
|
||||
for (i = 0; i < ndevices; i++)
|
||||
virNodeDeviceFree(devices[i]);
|
||||
virObjectUnref(devices[i]);
|
||||
VIR_FREE(devices);
|
||||
}
|
||||
return rv;
|
||||
|
@ -1825,10 +1825,8 @@ virNodeDeviceObjListExport(virConnectPtr conn,
|
||||
|
||||
cleanup:
|
||||
if (tmp_devices) {
|
||||
for (i = 0; i < ndevices; i++) {
|
||||
if (tmp_devices[i])
|
||||
virNodeDeviceFree(tmp_devices[i]);
|
||||
}
|
||||
for (i = 0; i < ndevices; i++)
|
||||
virObjectUnref(tmp_devices[i]);
|
||||
}
|
||||
|
||||
VIR_FREE(tmp_devices);
|
||||
|
@ -3387,8 +3387,7 @@ remoteConnectListAllNodeDevices(virConnectPtr conn,
|
||||
cleanup:
|
||||
if (tmp_devices) {
|
||||
for (i = 0; i < ret.devices.devices_len; i++)
|
||||
if (tmp_devices[i])
|
||||
virNodeDeviceFree(tmp_devices[i]);
|
||||
virObjectUnref(tmp_devices[i]);
|
||||
VIR_FREE(tmp_devices);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user