From a0b967e1c83b018956a80858d4750e25c315d9d2 Mon Sep 17 00:00:00 2001 From: Bradley Nicholes Date: Mon, 26 Apr 2004 19:46:14 +0000 Subject: [PATCH] Allow the memory address to change git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103532 13f79535-47bb-0310-9956-ffa450edef68 --- modules/experimental/util_ldap.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/experimental/util_ldap.c b/modules/experimental/util_ldap.c index 529bbaeea0..147e598bf9 100644 --- a/modules/experimental/util_ldap.c +++ b/modules/experimental/util_ldap.c @@ -89,16 +89,16 @@ void *util_ldap_create_config(apr_pool_t *p, server_rec *s); #endif -static void util_ldap_strdup (char *str, const char *newstr) +static void util_ldap_strdup (char **str, const char *newstr) { - if (str) { - free(str); - str = NULL; + if (*str) { + free(*str); + *str = NULL; } if (newstr) { - str = calloc(1, strlen(newstr)+1); - strcpy (str, newstr); + *str = calloc(1, strlen(newstr)+1); + strcpy (*str, newstr); } } @@ -415,8 +415,8 @@ LDAP_DECLARE(util_ldap_connection_t *)util_ldap_connection_find(request_rec *r, /* the bind credentials have changed */ l->bound = 0; - util_ldap_strdup((char*)l->binddn, binddn); - util_ldap_strdup((char*)l->bindpw, bindpw); + util_ldap_strdup((char**)&(l->binddn), binddn); + util_ldap_strdup((char**)&(l->bindpw), bindpw); break; } #if APR_HAS_THREADS @@ -454,8 +454,8 @@ LDAP_DECLARE(util_ldap_connection_t *)util_ldap_connection_find(request_rec *r, l->host = apr_pstrdup(st->pool, host); l->port = port; l->deref = deref; - util_ldap_strdup((char*)l->binddn, binddn); - util_ldap_strdup((char*)l->bindpw, bindpw); + util_ldap_strdup((char**)&(l->binddn), binddn); + util_ldap_strdup((char**)&(l->bindpw), bindpw); l->secure = secure; /* add the cleanup to the pool */ @@ -886,8 +886,8 @@ start_over: * it is bound to the original user id specified ldc->binddn when in fact it is * bound to a completely different user id. */ - util_ldap_strdup((char*)ldc->binddn, *binddn); - util_ldap_strdup((char*)ldc->bindpw, bindpw); + util_ldap_strdup((char**)&(ldc->binddn), *binddn); + util_ldap_strdup((char**)&(ldc->bindpw), bindpw); } /* -- 2.40.0