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

This commit is contained in:
Michael Friedrich 2013-07-30 14:34:54 +02:00
parent 30d4f509e9
commit 370ba8075a
1 changed files with 5 additions and 3 deletions

View File

@ -202,7 +202,11 @@ String MysqlDbConnection::Escape(const String& s)
mysql_real_escape_string(&m_Connection, to, s.CStr(), length); 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) Dictionary::Ptr MysqlDbConnection::FetchRow(MYSQL_RES *result)
@ -277,8 +281,6 @@ void MysqlDbConnection::DeactivateObject(const DbObject::Ptr& dbobj)
std::ostringstream qbuf; std::ostringstream qbuf;
qbuf << "UPDATE icinga_objects SET is_active = 0 WHERE object_id = " << static_cast<long>(dbref); qbuf << "UPDATE icinga_objects SET is_active = 0 WHERE object_id = " << static_cast<long>(dbref);
Query(qbuf.str()); Query(qbuf.str());
SetReference(dbobj, DbReference());
} }
/* caller must hold m_ConnectionMutex */ /* caller must hold m_ConnectionMutex */