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. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- cfg.mk | 4 ++-- daemon/remote.c | 2 +- src/nwfilter/nwfilter_driver.c | 6 ++---- src/remote/remote_driver.c | 3 +-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cfg.mk b/cfg.mk index e91cddf..bc9310d 100644 --- a/cfg.mk +++ b/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$$) diff --git a/daemon/remote.c b/daemon/remote.c index 60d05e1..dc00424 100644 --- a/daemon/remote.c +++ b/daemon/remote.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; diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index b41253d..0a04d5d 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -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); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 431a092..28bb46a 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -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); } -- 1.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list