From 90debec3291290822fa488486f88e192615cadf7 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Mon, 23 Nov 1998 19:57:00 +0000 Subject: [PATCH] plug newDN memory leak using Will Ballantyne's patch --- servers/slapd/back-ldbm/alias.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/servers/slapd/back-ldbm/alias.c b/servers/slapd/back-ldbm/alias.c index b7fbcf5328..5285087078 100644 --- a/servers/slapd/back-ldbm/alias.c +++ b/servers/slapd/back-ldbm/alias.c @@ -112,8 +112,8 @@ char *derefDN ( Backend *be, ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; - char *matched; - char *newDN; + char *matched = NULL; + char *newDN = NULL; int depth; Entry *eMatched; Entry *eDeref; @@ -156,6 +156,7 @@ char *derefDN ( Backend *be, if ((eNew = derefAlias_r( be, conn, op, eMatched )) == NULL) { free (matched); free (newDN); + newDN = NULL; free (remainder); break; /* no associated entry, dont deref */ } @@ -166,6 +167,7 @@ char *derefDN ( Backend *be, if (!strcasecmp (matched, eNew->e_dn)) { /* newDN same as old so not an alias, no need to go further */ free (newDN); + newDN = NULL; free (matched); free (remainder); break; @@ -226,9 +228,12 @@ char *derefDN ( Backend *be, send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM, "", "Maximum alias dereference depth exceeded for base" ); } + + if (newDN == NULL) { + newDN = strdup ( dn ); + } Debug( LDAP_DEBUG_TRACE, "<= returning deref DN of %s\n", newDN, 0, 0 ); - free(matched); return newDN; -- 2.39.5