From: Bhagya Tholpady (bbantwal) Date: Tue, 19 Jan 2021 16:24:57 +0000 (+0000) Subject: Merge pull request #2686 in SNORT/snort3 from ~OSHUMEIK/snort3:purge_trash to master X-Git-Tag: 3.1.1.0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96e33c8a17be75ae5d683f05ea96fc00e1dff257;p=thirdparty%2Fsnort3.git Merge pull request #2686 in SNORT/snort3 from ~OSHUMEIK/snort3:purge_trash to master Squashed commit of the following: commit 6946763e813ab16584b977647cf8c3b7fce5e434 Author: Oleksii Shumeiko Date: Tue Dec 22 13:42:38 2020 +0200 managers: clean all inactive inspectors ignoring referenced ones At the exit the framework guarantees all inactive inspectors will be cleaned up. --- diff --git a/src/managers/inspector_manager.cc b/src/managers/inspector_manager.cc index a17c76810..b33423a3a 100644 --- a/src/managers/inspector_manager.cc +++ b/src/managers/inspector_manager.cc @@ -358,26 +358,20 @@ void InspectorManager::dump_buffers() } } -#if 0 -static void dump_refs(PHList& trash) +static void purge_trash(const PHList& trash) { for ( auto* p : trash ) - { - if ( !p->is_inactive() ) - printf("%s = %u\n", p->get_api()->base.name, p->get_ref(0)); - } + if ( p->is_inactive() ) + InspectorManager::free_inspector(p); + else + LogMessage("Still-referenced inspector found in the trash: '%s'.\n", + p->get_api()->base.name); } -#endif - void InspectorManager::release_plugins() { - empty_trash(); - -#if 0 - dump_refs(s_trash); - dump_refs(s_trash2); -#endif + purge_trash(s_trash); + purge_trash(s_trash2); for ( auto* p : s_handlers ) {