diff --git a/cfg.mk b/cfg.mk index 4766f0bf461881870262fafb120a43a3b8938535..c7dfb76cad15c0b0ab04d3fd496cf310103be39e 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)Free\b' \ + @prohibit='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream)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).h|src/libvirt-(domain|qemu|network|nodedev|storage).c$$) + ^(docs/|tests/|examples/|tools/|cfg.mk|src/test/test_driver.c|src/libvirt_public.syms|include/libvirt/libvirt-(domain|network|nodedev|storage|stream).h|src/libvirt-(domain|qemu|network|nodedev|storage|stream).c$$) diff --git a/daemon/remote.c b/daemon/remote.c index fe1b13c386bb9977761a084c35b46ef7208e6322..b2f1c4614fd5b1894c88534158f9b9a8b287df8a 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -5414,7 +5414,7 @@ remoteDispatchDomainMigratePrepareTunnel3Params(virNetServerPtr server ATTRIBUTE virStreamAbort(st); daemonFreeClientStream(client, stream); } else { - virStreamFree(st); + virObjectUnref(st); } } return rv; diff --git a/daemon/stream.c b/daemon/stream.c index 88bc85871f68576b0a047d45eca621e47ab5aecd..dfe0bf904a47b16c52d020b88d89fb7b27324961 100644 --- a/daemon/stream.c +++ b/daemon/stream.c @@ -383,7 +383,7 @@ int daemonFreeClientStream(virNetServerClientPtr client, msg = tmp; } - virStreamFree(stream->st); + virObjectUnref(stream->st); VIR_FREE(stream); return ret; diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 022fe71e8a4d2d72e00afb46bdb6118acf374abf..5f28f2978bf6deffa847ed2e51e07a1c959800a5 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -221,7 +221,7 @@ static void virChrdevHashEntryFree(void *data, virStreamPtr st = data; /* free stream reference */ - virStreamFree(st); + virObjectUnref(st); /* delete lock file */ virChrdevLockFileRemove(dev); @@ -346,7 +346,6 @@ int virChrdevOpen(virChrdevsPtr devs, char *path; int ret; bool added = false; - virErrorPtr savedError; switch (source->type) { case VIR_DOMAIN_CHR_TYPE_PTY: @@ -434,15 +433,10 @@ int virChrdevOpen(virChrdevsPtr devs, return 0; error: - savedError = virSaveLastError(); - if (added) virHashRemoveEntry(devs->hash, path); else - virStreamFree(st); - - virSetError(savedError); - virFreeError(savedError); + virObjectUnref(st); if (cbdata) VIR_FREE(cbdata->path); diff --git a/src/fdstream.c b/src/fdstream.c index 9ff7e2a3620ede10efba1a3bd21c047bbc56d355..18bd35973980322bafaaedf9576ace6d1a9c04b0 100644 --- a/src/fdstream.c +++ b/src/fdstream.c @@ -187,8 +187,7 @@ static void virFDStreamEvent(int watch ATTRIBUTE_UNUSED, static void virFDStreamCallbackFree(void *opaque) { - virStreamPtr st = opaque; - virStreamFree(st); + virObjectUnref(opaque); } diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 830e1d475711cbca2c36a4219cc0ee309c1a046e..2eb251a1a67c2063c04d7813b546bd304b304882 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -5691,7 +5691,7 @@ static void remoteStreamCallbackFree(void *opaque) if (!cbdata->cb && cbdata->ff) (cbdata->ff)(cbdata->opaque); - virStreamFree(cbdata->st); + virObjectUnref(cbdata->st); VIR_FREE(opaque); }