[icinga-checkins] icinga.org: icinga-core/fix/ido2db-memory-leak-4210: This fixes memory leaks in ido2db caused by a failure to

git at icinga.org git at icinga.org
Mon May 27 18:28:07 CEST 2013


Module: icinga-core
Branch: fix/ido2db-memory-leak-4210
Commit: eac54536cc3d06565142cfa9b303d4946190a697
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=eac54536cc3d06565142cfa9b303d4946190a697

Author: Carl Friend <crfriend at rcn.com>
Date:   Mon May 27 12:24:53 2013 -0400

   This fixes memory leaks in ido2db caused by a failure to
free memory from libdbi calls for transaction start and end.

---

 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 efeb608..610ba85 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