]> git.sur5r.net Git - openldap/commitdiff
ITS#636, keys == NULL bug
authorKurt Zeilenga <kurt@openldap.org>
Tue, 25 Jul 2000 01:24:47 +0000 (01:24 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 25 Jul 2000 01:24:47 +0000 (01:24 +0000)
plus plug leak when keys != NULL

servers/slapd/back-ldbm/index.c

index 0d93e525ea58314e09bd1f8d9865d2f47df6f38d..db9f264fc25fde21a8750e7646519c496ac8255b 100644 (file)
@@ -174,10 +174,11 @@ static int indexer(
                        ad->ad_type->sat_equality,
                        &prefix, vals, &keys );
 
-               if( rc == LDAP_SUCCESS ) {
-                       for( i= 0; keys[i] != NULL; i++ ) {
+               if( rc == LDAP_SUCCESS && keys != NULL ) {
+                       for( i=0; keys[i] != NULL; i++ ) {
                                key_change( be, db, keys[i], id, op );
                        }
+                       ber_bvecfree( keys );
                }
        }
 
@@ -188,10 +189,11 @@ static int indexer(
                        ad->ad_type->sat_approx,
                        &prefix, vals, &keys );
 
-               if( rc == LDAP_SUCCESS ) {
-                       for( i= 0; keys[i] != NULL; i++ ) {
+               if( rc == LDAP_SUCCESS && keys != NULL ) {
+                       for( i=0; keys[i] != NULL; i++ ) {
                                key_change( be, db, keys[i], id, op );
                        }
+                       ber_bvecfree( keys );
                }
        }
 
@@ -202,10 +204,11 @@ static int indexer(
                        ad->ad_type->sat_substr,
                        &prefix, vals, &keys );
 
-               if( rc == LDAP_SUCCESS ) {
-                       for( i= 0; keys[i] != NULL; i++ ) {
+               if( rc == LDAP_SUCCESS && keys != NULL ) {
+                       for( i=0; keys[i] != NULL; i++ ) {
                                key_change( be, db, keys[i], id, op );
                        }
+                       ber_bvecfree( keys );
                }
        }