[icinga-checkins] icinga.org: icinga-core/cfriend/ido: Issue #4210 partial -- memory leak in ido2db

git at icinga.org git at icinga.org
Mon May 27 13:56:25 CEST 2013


Module: icinga-core
Branch: cfriend/ido
Commit: 37ceb9fa31d770e871912344cac894a10b2b17a9
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=37ceb9fa31d770e871912344cac894a10b2b17a9

Author: Carl Friend <crfriend at rcn.com>
Date:   Sun May 26 21:49:35 2013 -0400

Issue #4210 partial -- memory leak in ido2db

This patch addresses a memory leak in ido2db that causes the
process to grow over time and consume excessive machine resources.
It represents a partial fix for #4210 as it does not address the
large number of BEGIN/COMMIT statements with no intervening SQL.

---

 module/idoutils/src/db.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
index d824d63..7fc3413 100644
--- a/module/idoutils/src/db.c
+++ b/module/idoutils/src/db.c
@@ -2905,18 +2905,24 @@ int ido2db_db_perform_maintenance(ido2db_idi *idi) {
 }
 
 int ido2db_db_tx_begin(ido2db_idi *idi) {
+	int result = IDO_ERROR;
 #ifdef USE_LIBDBI
 	ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_db_tx_begin()\n");
-	return ido2db_db_query(idi, "BEGIN");
+	result = ido2db_db_query(idi, "BEGIN");
+	dbi_result_free(idi->dbinfo.dbi_result);
+	return result;
 #else /* USE_LIBDBI */
 	return IDO_OK;
 #endif /* USE_LIBDBI */
 }
 
 int ido2db_db_tx_commit(ido2db_idi *idi) {
+	int result = IDO_ERROR;
 #ifdef USE_LIBDBI
 	ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_db_tx_commit()\n");
-	return ido2db_db_query(idi, "COMMIT");
+	result = ido2db_db_query(idi, "COMMIT");
+	dbi_result_free(idi->dbinfo.dbi_result);
+	return result;
 #else /* USE_LIBDBI */
 	return IDO_OK;
 #endif /* USE_LIBDBI */





More information about the icinga-checkins mailing list