]> git.sur5r.net Git - openldap/commitdiff
Fix crasher in attr_merge_normalize_one()
authorLuke Howard <lukeh@openldap.org>
Thu, 24 Apr 2003 10:40:45 +0000 (10:40 +0000)
committerLuke Howard <lukeh@openldap.org>
Thu, 24 Apr 2003 10:40:45 +0000 (10:40 +0000)
servers/slapd/attr.c

index d1023d96231ce053d6176a926cfe5cc7219bba0c..3c5f77d60155d2aa262de8776c7939e7c756397c 100644 (file)
@@ -230,6 +230,7 @@ attr_merge_normalize_one(
        void            *memctx
 ) {
        struct berval   nval;
+       struct berval   *nvalp;
        int             rc;
 
        if ( desc->ad_type->sat_equality->smr_normalize ) {
@@ -242,10 +243,15 @@ attr_merge_normalize_one(
                if ( rc != LDAP_SUCCESS ) {
                        return rc;
                }
+               nvalp = &nval;
+       } else {
+               nvalp = NULL;
        }
 
-       rc = attr_merge_one( e, desc, val, &nval );
-       ch_free( nval.bv_val );
+       rc = attr_merge_one( e, desc, val, nvalp );
+       if ( nvalp != NULL ) {
+               ch_free( nval.bv_val );
+       }
        return rc;
 }