From 370ba8075a903cc05f34d69d6a118baedda4c673 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 30 Jul 2013 14:34:54 +0200 Subject: [PATCH] ido: fix mem leak; don't invalidate dbref on object inactive --- components/ido_mysql/mysqldbconnection.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/ido_mysql/mysqldbconnection.cpp b/components/ido_mysql/mysqldbconnection.cpp index 15e944d3a..30f1e463e 100644 --- a/components/ido_mysql/mysqldbconnection.cpp +++ b/components/ido_mysql/mysqldbconnection.cpp @@ -202,7 +202,11 @@ String MysqlDbConnection::Escape(const String& s) mysql_real_escape_string(&m_Connection, to, s.CStr(), length); - return String(to); + String result = String(to); + + delete [] to; + + return result; } Dictionary::Ptr MysqlDbConnection::FetchRow(MYSQL_RES *result) @@ -277,8 +281,6 @@ void MysqlDbConnection::DeactivateObject(const DbObject::Ptr& dbobj) std::ostringstream qbuf; qbuf << "UPDATE icinga_objects SET is_active = 0 WHERE object_id = " << static_cast(dbref); Query(qbuf.str()); - - SetReference(dbobj, DbReference()); } /* caller must hold m_ConnectionMutex */