From 89d4bcb473418d6571b4a353de2c0fdae85f266c Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 9 Apr 2007 23:02:41 +0000 Subject: Resolves: bug 235743 Bug Description: small memory leaks in task code Reviewed by: nkinder, nhosoi (Thanks!) Fix Description: There were a few places that were using slapi_get_first/next_backend without freeing the iterator cookie. Platforms tested: RHEL4 Flag Day: no Doc impact: no --- ldap/servers/slapd/backend_manager.c | 1 + ldap/servers/slapd/task.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ldap/servers/slapd/backend_manager.c b/ldap/servers/slapd/backend_manager.c index b8af0eb6..ca355ca9 100644 --- a/ldap/servers/slapd/backend_manager.c +++ b/ldap/servers/slapd/backend_manager.c @@ -496,6 +496,7 @@ slapi_lookup_instance_name_by_suffix(char *suffix, PR_Unlock(be->be_suffixlock); be = (backend *)slapi_get_next_backend (cookie); } + slapi_ch_free((void **)&cookie); return rval; } diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c index 629933b3..f01cf28a 100644 --- a/ldap/servers/slapd/task.c +++ b/ldap/servers/slapd/task.c @@ -1028,6 +1028,7 @@ static int task_backup_add(Slapi_PBlock *pb, Slapi_Entry *e, be = (backend *)slapi_get_next_backend (cookie); } + slapi_ch_free((void **)&cookie); if (NULL == be || NULL == be->be_database->plg_db2archive) { LDAPDebug(LDAP_DEBUG_ANY, "ERROR: no db2archive function defined.\n", 0, 0, 0); @@ -1174,6 +1175,7 @@ static int task_restore_add(Slapi_PBlock *pb, Slapi_Entry *e, be = (backend *)slapi_get_next_backend (cookie); } + slapi_ch_free((void **)&cookie); if (NULL == be || NULL == be->be_database->plg_archive2db) { LDAPDebug(LDAP_DEBUG_ANY, "ERROR: no db2archive function defined.\n", 0, 0, 0); @@ -1443,6 +1445,7 @@ task_upgradedb_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter, be = (backend *)slapi_get_next_backend (cookie); } + slapi_ch_free((void **)&cookie); if (NULL == be || NULL == be->be_database->plg_upgradedb || strcasecmp(database_type, be->be_database->plg_name)) { LDAPDebug(LDAP_DEBUG_ANY, -- cgit