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:
John Ferlan 2014-11-30 12:03:00 -05:00
parent a0b13d35e7
commit 7b4938f524
4 changed files with 6 additions and 9 deletions

4
cfg.mk
View File

@ -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|NodeDevice|StorageVol|StoragePool|Stream|Secret)Free\b' \ @prohibit='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter)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 = \
^(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/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$$)

View File

@ -4964,7 +4964,7 @@ remoteDispatchConnectListAllNWFilters(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetMessageSaveError(rerr); virNetMessageSaveError(rerr);
if (filters && nfilters > 0) { if (filters && nfilters > 0) {
for (i = 0; i < nfilters; i++) for (i = 0; i < nfilters; i++)
virNWFilterFree(filters[i]); virObjectUnref(filters[i]);
VIR_FREE(filters); VIR_FREE(filters);
} }
return rv; return rv;

View File

@ -547,10 +547,8 @@ nwfilterConnectListAllNWFilters(virConnectPtr conn,
cleanup: cleanup:
nwfilterDriverUnlock(driver); nwfilterDriverUnlock(driver);
if (tmp_filters) { if (tmp_filters) {
for (i = 0; i < nfilters; i ++) { for (i = 0; i < nfilters; i ++)
if (tmp_filters[i]) virObjectUnref(tmp_filters[i]);
virNWFilterFree(tmp_filters[i]);
}
} }
VIR_FREE(tmp_filters); VIR_FREE(tmp_filters);

View File

@ -3452,8 +3452,7 @@ remoteConnectListAllNWFilters(virConnectPtr conn,
cleanup: cleanup:
if (tmp_filters) { if (tmp_filters) {
for (i = 0; i < ret.filters.filters_len; i++) for (i = 0; i < ret.filters.filters_len; i++)
if (tmp_filters[i]) virObjectUnref(tmp_filters[i]);
virNWFilterFree(tmp_filters[i]);
VIR_FREE(tmp_filters); VIR_FREE(tmp_filters);
} }