From 5f67bfbc8eec11189b0e60dbcee4bd273cbb1cc8 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 10 Aug 2007 21:07:41 +0000 Subject: [PATCH] Fix possible sqllog crash (working blind here!) where it could attempt to delete a pointer without knowing if that pointer was valid. (NEVER EVER use operator[] to lookup a map value, always use ::find()) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7700 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_sqllog.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 391e4bbba..d572ae92f 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -166,8 +166,12 @@ public: break; case DONE: - delete active_queries[req.id]; - active_queries[req.id] = NULL; + std::map::iterator x = active_queries.find(req.id); + if (x != active_queres.end()) + { + delete x->second; + active_queries.erase(x); + } break; } } -- 2.39.5