]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/sets.c
Plug mutex/rwlock leaks (destroy them)
[openldap] / servers / slapd / sets.c
index d7c56fa9ed4b41f2726b389f8ef3cb853f4949a2..2475be54179eb64f286a69e938318660c07d9eae 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2008 The OpenLDAP Foundation.
+ * Copyright 2000-2010 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -120,7 +120,7 @@ set_dup( SetCookie *cp, BerVarray set, unsigned flags )
 /* Join two sets according to operator op and flags op_flags.
  * op can be:
  *     '|' (or):       the union between the two sets is returned,
- *                     eliminating diplicates
+ *                     eliminating duplicates
  *     '&' (and):      the intersection between the two sets
  *                     is returned
  *     '+' (add):      the inner product of the two sets is returned,
@@ -200,6 +200,7 @@ slap_set_join(
                                                        cp->set_op->o_tmpfree( rset[ i ].bv_val, cp->set_op->o_tmpmemctx );
                                                        rset[ i ] = rset[ --rlast ];
                                                        BER_BVZERO( &rset[ rlast ] );
+                                                       i--;
                                                }
                                                exists = 1;
                                                break;
@@ -725,6 +726,7 @@ slap_set_filter( SLAP_SET_GATHER gatherer,
                        if ( len == 4
                                && memcmp( "this", filter, len ) == 0 )
                        {
+                               assert( !BER_BVISNULL( target ) );
                                if ( ( SF_TOP() == (void *)'/' ) || IS_SET( SF_TOP() ) ) {
                                        SF_ERROR( syntax );
                                }
@@ -745,15 +747,15 @@ slap_set_filter( SLAP_SET_GATHER gatherer,
                                if ( ( SF_TOP() == (void *)'/' ) || IS_SET( SF_TOP() ) ) {
                                        SF_ERROR( syntax );
                                }
+                               if ( BER_BVISNULL( user ) ) {
+                                       SF_ERROR( memory );
+                               }
                                set = cp->set_op->o_tmpcalloc( 2, sizeof( struct berval ),
                                                cp->set_op->o_tmpmemctx );
                                if ( set == NULL ) {
                                        SF_ERROR( memory );
                                }
                                ber_dupbv_x( set, user, cp->set_op->o_tmpmemctx );
-                               if ( BER_BVISNULL( set ) ) {
-                                       SF_ERROR( memory );
-                               }
                                BER_BVZERO( &set[ 1 ] );
                                
                        } else if ( SF_TOP() != (void *)'/' ) {