Fixed memory leaks.

This commit is contained in:
Kurt Zeilenga 1998-10-24 06:11:30 +00:00
parent 32d9124fed
commit 708e5abb08

View File

@ -66,6 +66,8 @@ Entry *derefAlias_r ( Backend *be,
oldDN, newDN, 0 );
send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM, "",
"Dangling Alias" );
if(matched != NULL) free(matched);
}
free (newDN);
free (oldDN);
@ -151,6 +153,7 @@ char *derefDN ( Backend *be,
if ((eNew = derefAlias_r( be, conn, op, eMatched )) == NULL) {
free (matched);
free (newDN);
free (remainder);
break; /* no associated entry, dont deref */
}
else {
@ -161,6 +164,7 @@ char *derefDN ( Backend *be,
/* newDN same as old so not an alias, no need to go further */
free (newDN);
free (matched);
free (remainder);
break;
}
@ -176,6 +180,8 @@ char *derefDN ( Backend *be,
strcat (newDN, eMatched->e_dn);
Debug( LDAP_DEBUG_TRACE, "<= expanded to %s\n", newDN, 0, 0 );
free (remainder);
/* free reader lock */
cache_return_entry_r(&li->li_cache, eNew);
}
@ -183,6 +189,7 @@ char *derefDN ( Backend *be,
cache_return_entry_r(&li->li_cache, eMatched);
}
else {
if(submatch != NULL) free(submatch);
break; /* there was no entry for the matched part */
}
}
@ -219,5 +226,7 @@ char *derefDN ( Backend *be,
Debug( LDAP_DEBUG_TRACE, "<= returning deref DN of %s\n", newDN, 0, 0 );
free(matched);
return newDN;
}