提交 e3b456de 编写于 作者: J John Ferlan

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.
上级 121c09a9
...@@ -992,7 +992,7 @@ sc_prohibit_system_error_with_vir_err: ...@@ -992,7 +992,7 @@ sc_prohibit_system_error_with_vir_err:
# functions. There's a corresponding exclude to allow usage within tests, # functions. There's a corresponding exclude to allow usage within tests,
# docs, examples, tools, src/libvirt-*.c, and include/libvirt/libvirt-*.h # docs, examples, tools, src/libvirt-*.c, and include/libvirt/libvirt-*.h
sc_prohibit_virXXXFree: sc_prohibit_virXXXFree:
@prohibit='\bvir(Domain|Network)Free\b' \ @prohibit='\bvir(Domain|Network|NodeDevice)Free\b' \
exclude='sc_prohibit_virXXXFree' \ exclude='sc_prohibit_virXXXFree' \
halt='avoid using 'virXXXFree', use 'virObjectUnref' instead' \ halt='avoid using 'virXXXFree', use 'virObjectUnref' instead' \
$(_sc_search_regexp) $(_sc_search_regexp)
...@@ -1186,4 +1186,4 @@ exclude_file_name_regexp--sc_prohibit_devname = \ ...@@ -1186,4 +1186,4 @@ exclude_file_name_regexp--sc_prohibit_devname = \
^(tools/virsh.pod|cfg.mk|docs/.*)$$ ^(tools/virsh.pod|cfg.mk|docs/.*)$$
exclude_file_name_regexp--sc_prohibit_virXXXFree = \ 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, ...@@ -3375,8 +3375,7 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup: cleanup:
if (rv < 0) if (rv < 0)
virNetMessageSaveError(rerr); virNetMessageSaveError(rerr);
if (dev) virObjectUnref(dev);
virNodeDeviceFree(dev);
return rv; return rv;
} }
...@@ -4908,7 +4907,7 @@ remoteDispatchConnectListAllNodeDevices(virNetServerPtr server ATTRIBUTE_UNUSED, ...@@ -4908,7 +4907,7 @@ remoteDispatchConnectListAllNodeDevices(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetMessageSaveError(rerr); virNetMessageSaveError(rerr);
if (devices && ndevices > 0) { if (devices && ndevices > 0) {
for (i = 0; i < ndevices; i++) for (i = 0; i < ndevices; i++)
virNodeDeviceFree(devices[i]); virObjectUnref(devices[i]);
VIR_FREE(devices); VIR_FREE(devices);
} }
return rv; return rv;
......
...@@ -1825,10 +1825,8 @@ virNodeDeviceObjListExport(virConnectPtr conn, ...@@ -1825,10 +1825,8 @@ virNodeDeviceObjListExport(virConnectPtr conn,
cleanup: cleanup:
if (tmp_devices) { if (tmp_devices) {
for (i = 0; i < ndevices; i++) { for (i = 0; i < ndevices; i++)
if (tmp_devices[i]) virObjectUnref(tmp_devices[i]);
virNodeDeviceFree(tmp_devices[i]);
}
} }
VIR_FREE(tmp_devices); VIR_FREE(tmp_devices);
......
...@@ -3387,8 +3387,7 @@ remoteConnectListAllNodeDevices(virConnectPtr conn, ...@@ -3387,8 +3387,7 @@ remoteConnectListAllNodeDevices(virConnectPtr conn,
cleanup: cleanup:
if (tmp_devices) { if (tmp_devices) {
for (i = 0; i < ret.devices.devices_len; i++) for (i = 0; i < ret.devices.devices_len; i++)
if (tmp_devices[i]) virObjectUnref(tmp_devices[i]);
virNodeDeviceFree(tmp_devices[i]);
VIR_FREE(tmp_devices); VIR_FREE(tmp_devices);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册