diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc
index 0444e52258c..bb8584a1e0b 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -635,7 +635,7 @@ epath_finder::dump_feasible_path (const exploded_node *target_enode,
 saved_diagnostic::saved_diagnostic (const state_machine *sm,
 				    const exploded_node *enode,
 				    const supernode *snode, const gimple *stmt,
-				    stmt_finder *stmt_finder,
+				    const stmt_finder *stmt_finder,
 				    tree var,
 				    const svalue *sval,
 				    state_machine::state_t state,
@@ -662,7 +662,6 @@ saved_diagnostic::saved_diagnostic (const state_machine *sm,
 
 saved_diagnostic::~saved_diagnostic ()
 {
-  delete m_stmt_finder;
   delete m_best_epath;
   delete m_problem;
 }
@@ -961,7 +960,7 @@ bool
 diagnostic_manager::add_diagnostic (const state_machine *sm,
 				    exploded_node *enode,
 				    const supernode *snode, const gimple *stmt,
-				    stmt_finder *finder,
+				    const stmt_finder *finder,
 				    tree var,
 				    const svalue *sval,
 				    state_machine::state_t state,
@@ -1010,7 +1009,7 @@ diagnostic_manager::add_diagnostic (const state_machine *sm,
 bool
 diagnostic_manager::add_diagnostic (exploded_node *enode,
 				    const supernode *snode, const gimple *stmt,
-				    stmt_finder *finder,
+				    const stmt_finder *finder,
 				    std::unique_ptr<pending_diagnostic> d)
 {
   gcc_assert (enode);
diff --git a/gcc/analyzer/diagnostic-manager.h b/gcc/analyzer/diagnostic-manager.h
index fdab038d7a1..c87f2159753 100644
--- a/gcc/analyzer/diagnostic-manager.h
+++ b/gcc/analyzer/diagnostic-manager.h
@@ -33,7 +33,7 @@ public:
   saved_diagnostic (const state_machine *sm,
 		    const exploded_node *enode,
 		    const supernode *snode, const gimple *stmt,
-		    stmt_finder *stmt_finder,
+		    const stmt_finder *stmt_finder,
 		    tree var, const svalue *sval,
 		    state_machine::state_t state,
 		    std::unique_ptr<pending_diagnostic> d,
@@ -72,7 +72,7 @@ public:
   const exploded_node *m_enode;
   const supernode *m_snode;
   const gimple *m_stmt;
-  stmt_finder *m_stmt_finder;
+  std::unique_ptr<stmt_finder> m_stmt_finder;
   tree m_var;
   const svalue *m_sval;
   state_machine::state_t m_state;
@@ -113,7 +113,7 @@ public:
   bool add_diagnostic (const state_machine *sm,
 		       exploded_node *enode,
 		       const supernode *snode, const gimple *stmt,
-		       stmt_finder *finder,
+		       const stmt_finder *finder,
 		       tree var,
 		       const svalue *sval,
 		       state_machine::state_t state,
@@ -121,7 +121,7 @@ public:
 
   bool add_diagnostic (exploded_node *enode,
 		       const supernode *snode, const gimple *stmt,
-		       stmt_finder *finder,
+		       const stmt_finder *finder,
 		       std::unique_ptr<pending_diagnostic> d);
 
   void add_note (std::unique_ptr<pending_note> pn);
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index fd532b1384d..553957ad982 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -282,7 +282,7 @@ public:
 		   const sm_state_map *old_smap,
 		   sm_state_map *new_smap,
 		   path_context *path_ctxt,
-		   stmt_finder *stmt_finder = NULL,
+		   const stmt_finder *stmt_finder = NULL,
 		   bool unknown_side_effects = false)
   : sm_context (sm_idx, sm),
     m_logger (eg.get_logger ()),
@@ -523,7 +523,7 @@ public:
   const sm_state_map *m_old_smap;
   sm_state_map *m_new_smap;
   path_context *m_path_ctxt;
-  stmt_finder *m_stmt_finder;
+  const stmt_finder *m_stmt_finder;
 
   /* Are we handling an external function with unknown side effects?  */
   bool m_unknown_side_effects;
@@ -538,9 +538,9 @@ public:
   leak_stmt_finder (const exploded_graph &eg, tree var)
   : m_eg (eg), m_var (var) {}
 
-  stmt_finder *clone () const final override
+  std::unique_ptr<stmt_finder> clone () const final override
   {
-    return new leak_stmt_finder (m_eg, m_var);
+    return make_unique<leak_stmt_finder> (m_eg, m_var);
   }
 
   const gimple *find_stmt (const exploded_path &epath)
diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h
index dae73daf54a..7947f50cdd7 100644
--- a/gcc/analyzer/exploded-graph.h
+++ b/gcc/analyzer/exploded-graph.h
@@ -991,7 +991,7 @@ class stmt_finder
 {
 public:
   virtual ~stmt_finder () {}
-  virtual stmt_finder *clone () const = 0;
+  virtual std::unique_ptr<stmt_finder> clone () const = 0;
   virtual const gimple *find_stmt (const exploded_path &epath) = 0;
 };
 
