Browse Source

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

Rich Megginson 18 years ago
parent
commit
89d4bcb473
2 changed files with 4 additions and 0 deletions
  1. 1 0
      ldap/servers/slapd/backend_manager.c
  2. 3 0
      ldap/servers/slapd/task.c

+ 1 - 0
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;
 }

+ 3 - 0
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,