]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2686 in SNORT/snort3 from ~OSHUMEIK/snort3:purge_trash to master
authorBhagya Tholpady (bbantwal) <bbantwal@cisco.com>
Tue, 19 Jan 2021 16:24:57 +0000 (16:24 +0000)
committerBhagya Tholpady (bbantwal) <bbantwal@cisco.com>
Tue, 19 Jan 2021 16:24:57 +0000 (16:24 +0000)
Squashed commit of the following:

commit 6946763e813ab16584b977647cf8c3b7fce5e434
Author: Oleksii Shumeiko <oshumeik@cisco.com>
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.

src/managers/inspector_manager.cc

index a17c7681078ce15154251e2b6457ff875d4b95fa..b33423a3a24981b5fb09bd72d37981d4c5193577 100644 (file)
@@ -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 )
     {