[icinga-checkins] icinga.org: icinga2/master: ido: fix mem leak; don' t invalidate dbref on object inactive

git at icinga.org git at icinga.org
Tue Jul 30 14:35:56 CEST 2013


Module: icinga2
Branch: master
Commit: 370ba8075a903cc05f34d69d6a118baedda4c673
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=370ba8075a903cc05f34d69d6a118baedda4c673

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Tue Jul 30 14:34:54 2013 +0200

ido: fix mem leak; don't invalidate dbref on object inactive

---

 components/ido_mysql/mysqldbconnection.cpp |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/components/ido_mysql/mysqldbconnection.cpp b/components/ido_mysql/mysqldbconnection.cpp
index 15e944d..30f1e46 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<long>(dbref);
 	Query(qbuf.str());
-
-	SetReference(dbobj, DbReference());
 }
 
 /* caller must hold m_ConnectionMutex */





More information about the icinga-checkins mailing list