]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/suffixalias.c
Cleanup slapd search op deallocation.
[openldap] / servers / slapd / suffixalias.c
index 26b990cd57972108ca9b8b4ba98d8701ac3a9763..31a09838cba2742725b4b0b2bd6e4d1f84aa04d7 100644 (file)
@@ -25,6 +25,8 @@ char *suffixAlias (char *dn, Operation *op, Backend *be)
 {
        int     i, dnLength;
 
+       if(dn == NULL) return NULL;
+
        dnLength = strlen ( dn );
         op->o_suffix = NULL;
         op->o_suffixAliased = NULL;
@@ -39,12 +41,12 @@ char *suffixAlias (char *dn, Operation *op, Backend *be)
                 if (!strcasecmp(be->be_suffixAlias[i], 
                                dn + (dnLength - aliasLength))) {
                         char *oldDN = dn;
-                        op->o_suffixAliased = strdup ( be->be_suffixAlias[i] );
+                        op->o_suffixAliased = ch_strdup ( be->be_suffixAlias[i] );
                         dn = ch_malloc ( (dnLength - aliasLength) +
                                           strlen (be->be_suffixAlias[ i+1 ]) + 1);
                         strncpy (dn, oldDN, dnLength - aliasLength);
                         strcpy  (dn + (dnLength - aliasLength), be->be_suffixAlias[ i+1 ]);
-                        op->o_suffix = strdup (dn);
+                        op->o_suffix = ch_strdup (dn);
                         Debug( LDAP_DEBUG_ARGS, "ALIAS: converted %s to %s", oldDN, dn, 0);
                         free (oldDN);
                        break;