mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
Replace virNWFilterFree with virObjectUnref
Since virNWFilterFree 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
a0b13d35e7
commit
7b4938f524
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|NodeDevice|StorageVol|StoragePool|Stream|Secret)Free\b' \
|
||||
@prohibit='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter)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/test/test_driver.c|src/libvirt_public.syms|include/libvirt/libvirt-(domain|network|nodedev|storage|stream|secret).h|src/libvirt-(domain|qemu|network|nodedev|storage|stream|secret).c$$)
|
||||
^(docs/|tests/|examples/|tools/|cfg.mk|src/test/test_driver.c|src/libvirt_public.syms|include/libvirt/libvirt-(domain|network|nodedev|storage|stream|secret|nwfilter).h|src/libvirt-(domain|qemu|network|nodedev|storage|stream|secret|nwfilter).c$$)
|
||||
|
@ -4964,7 +4964,7 @@ remoteDispatchConnectListAllNWFilters(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetMessageSaveError(rerr);
|
||||
if (filters && nfilters > 0) {
|
||||
for (i = 0; i < nfilters; i++)
|
||||
virNWFilterFree(filters[i]);
|
||||
virObjectUnref(filters[i]);
|
||||
VIR_FREE(filters);
|
||||
}
|
||||
return rv;
|
||||
|
@ -547,10 +547,8 @@ nwfilterConnectListAllNWFilters(virConnectPtr conn,
|
||||
cleanup:
|
||||
nwfilterDriverUnlock(driver);
|
||||
if (tmp_filters) {
|
||||
for (i = 0; i < nfilters; i ++) {
|
||||
if (tmp_filters[i])
|
||||
virNWFilterFree(tmp_filters[i]);
|
||||
}
|
||||
for (i = 0; i < nfilters; i ++)
|
||||
virObjectUnref(tmp_filters[i]);
|
||||
}
|
||||
VIR_FREE(tmp_filters);
|
||||
|
||||
|
@ -3452,8 +3452,7 @@ remoteConnectListAllNWFilters(virConnectPtr conn,
|
||||
cleanup:
|
||||
if (tmp_filters) {
|
||||
for (i = 0; i < ret.filters.filters_len; i++)
|
||||
if (tmp_filters[i])
|
||||
virNWFilterFree(tmp_filters[i]);
|
||||
virObjectUnref(tmp_filters[i]);
|
||||
VIR_FREE(tmp_filters);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user