Commit 06212e9d authored by Howard Chu's avatar Howard Chu
Browse files

Plug leaks

parent 7beb587a
...@@ -5245,6 +5245,9 @@ int config_entry_release( ...@@ -5245,6 +5245,9 @@ int config_entry_release(
Entry *e, Entry *e,
int rw ) int rw )
{ {
if ( !e->e_private ) {
entry_free( e );
}
return LDAP_SUCCESS; return LDAP_SUCCESS;
} }
......
...@@ -1982,7 +1982,7 @@ connection_fake_init( ...@@ -1982,7 +1982,7 @@ connection_fake_init(
Operation *op, Operation *op,
void *ctx ) void *ctx )
{ {
connection_fake_init2( conn, op, ctx, 0 ); connection_fake_init2( conn, op, ctx, 1 );
} }
void void
......
...@@ -138,12 +138,12 @@ slap_parse_csn_sid( struct berval *csn ) ...@@ -138,12 +138,12 @@ slap_parse_csn_sid( struct berval *csn )
} }
int * int *
slap_parse_csn_sids( BerVarray csns, int numcsns ) slap_parse_csn_sids( BerVarray csns, int numcsns, void *memctx )
{ {
int i, *ret; int i, *ret;
char *p, *q; char *p, *q;
ret = ch_malloc( numcsns * sizeof(int) ); ret = slap_sl_malloc( numcsns * sizeof(int), memctx );
for ( i=0; i<numcsns; i++ ) { for ( i=0; i<numcsns; i++ ) {
ret[i] = slap_parse_csn_sid( &csns[i] ); ret[i] = slap_parse_csn_sid( &csns[i] );
} }
...@@ -235,7 +235,9 @@ slap_parse_sync_cookie( ...@@ -235,7 +235,9 @@ slap_parse_sync_cookie(
else else
stamp.bv_len = end - csn_str; stamp.bv_len = end - csn_str;
if ( ad ) { if ( ad ) {
value_add_one( &cookie->ctxcsn, &stamp ); struct berval bv;
ber_dupbv_x( &bv, &stamp, memctx );
ber_bvarray_add_x( &cookie->ctxcsn, &bv, memctx );
cookie->numcsns++; cookie->numcsns++;
} }
if ( cval ) { if ( cval ) {
...@@ -252,7 +254,8 @@ slap_parse_sync_cookie( ...@@ -252,7 +254,8 @@ slap_parse_sync_cookie(
next++; next++;
} }
if ( cookie->numcsns ) { if ( cookie->numcsns ) {
cookie->sids = slap_parse_csn_sids( cookie->ctxcsn, cookie->numcsns ); cookie->sids = slap_parse_csn_sids( cookie->ctxcsn, cookie->numcsns,
memctx );
} }
return 0; return 0;
} }
......
...@@ -1220,9 +1220,11 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) ...@@ -1220,9 +1220,11 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex ); ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
if ( op->o_tag != LDAP_REQ_ADD && e ) { if ( op->o_tag != LDAP_REQ_ADD && e ) {
op->o_bd->bd_info = (BackendInfo *)on->on_info; if ( !SLAP_ISOVERLAY( op->o_bd )) {
be_entry_release_rw( op, e, 0 ); op->o_bd = &db;
op->o_bd->bd_info = (BackendInfo *)on; }
overlay_entry_release_ov( op, e, 0, on );
op->o_bd = b0;
} }
if ( freefdn ) { if ( freefdn ) {
op->o_tmpfree( fc.fdn->bv_val, op->o_tmpmemctx ); op->o_tmpfree( fc.fdn->bv_val, op->o_tmpmemctx );
...@@ -2545,7 +2547,7 @@ syncprov_db_open( ...@@ -2545,7 +2547,7 @@ syncprov_db_open(
ber_bvarray_dup_x( &si->si_ctxcsn, a->a_vals, NULL ); ber_bvarray_dup_x( &si->si_ctxcsn, a->a_vals, NULL );
for ( i = 0; !BER_BVISNULL( &a->a_vals[i] ); i++ ); for ( i = 0; !BER_BVISNULL( &a->a_vals[i] ); i++ );
si->si_numcsns = i; si->si_numcsns = i;
si->si_sids = slap_parse_csn_sids( si->si_ctxcsn, i ); si->si_sids = slap_parse_csn_sids( si->si_ctxcsn, i, NULL );
} }
overlay_entry_release_ov( op, e, 0, on ); overlay_entry_release_ov( op, e, 0, on );
if ( si->si_ctxcsn ) { if ( si->si_ctxcsn ) {
......
...@@ -1040,7 +1040,7 @@ LDAP_SLAPD_F (void) slap_sync_cookie_free LDAP_P(( ...@@ -1040,7 +1040,7 @@ LDAP_SLAPD_F (void) slap_sync_cookie_free LDAP_P((
LDAP_SLAPD_F (int) slap_parse_csn_sid LDAP_P(( LDAP_SLAPD_F (int) slap_parse_csn_sid LDAP_P((
struct berval * )); struct berval * ));
LDAP_SLAPD_F (int *) slap_parse_csn_sids LDAP_P(( LDAP_SLAPD_F (int *) slap_parse_csn_sids LDAP_P((
BerVarray, int )); BerVarray, int, void *memctx ));
LDAP_SLAPD_F (int) slap_parse_sync_cookie LDAP_P(( LDAP_SLAPD_F (int) slap_parse_sync_cookie LDAP_P((
struct sync_cookie *, void *memctx )); struct sync_cookie *, void *memctx ));
LDAP_SLAPD_F (int) slap_init_sync_cookie_ctxcsn LDAP_P(( LDAP_SLAPD_F (int) slap_init_sync_cookie_ctxcsn LDAP_P((
......
...@@ -499,7 +499,7 @@ do_syncrep1( ...@@ -499,7 +499,7 @@ do_syncrep1(
si->si_cookieState->cs_vals = csn; si->si_cookieState->cs_vals = csn;
for (i=0; !BER_BVISNULL( &csn[i] ); i++); for (i=0; !BER_BVISNULL( &csn[i] ); i++);
si->si_cookieState->cs_num = i; si->si_cookieState->cs_num = i;
si->si_cookieState->cs_sids = slap_parse_csn_sids( csn, i ); si->si_cookieState->cs_sids = slap_parse_csn_sids( csn, i, NULL );
} }
} }
if ( si->si_cookieState->cs_num ) { if ( si->si_cookieState->cs_num ) {
...@@ -567,7 +567,7 @@ do_syncrep1( ...@@ -567,7 +567,7 @@ do_syncrep1(
si->si_cookieState->cs_num = num; si->si_cookieState->cs_num = num;
si->si_cookieState->cs_vals = a.a_vals; si->si_cookieState->cs_vals = a.a_vals;
si->si_cookieState->cs_sids = slap_parse_csn_sids( a.a_vals, si->si_cookieState->cs_sids = slap_parse_csn_sids( a.a_vals,
num ); num, NULL );
si->si_cookieState->cs_age++; si->si_cookieState->cs_age++;
} else { } else {
ber_bvarray_free( a.a_vals ); ber_bvarray_free( a.a_vals );
...@@ -852,11 +852,11 @@ do_syncrep2( ...@@ -852,11 +852,11 @@ do_syncrep2(
} }
ber_scanf( ber, /*"{"*/ "}" ); ber_scanf( ber, /*"{"*/ "}" );
} }
if ( !syncCookie_req.ctxcsn ) { if ( !syncCookie.ctxcsn ) {
match = 1;
} else if ( !syncCookie_req.ctxcsn ) {
match = -1; match = -1;
m = 0; m = 0;
} else if ( !syncCookie.ctxcsn ) {
match = 1;
} else { } else {
match = compare_csns( &syncCookie_req, &syncCookie, &m ); match = compare_csns( &syncCookie_req, &syncCookie, &m );
} }
...@@ -999,11 +999,11 @@ do_syncrep2( ...@@ -999,11 +999,11 @@ do_syncrep2(
continue; continue;
} }
if ( !syncCookie_req.ctxcsn ) { if ( !syncCookie.ctxcsn ) {
match = 1;
} else if ( !syncCookie_req.ctxcsn ) {
match = -1; match = -1;
m = 0; m = 0;
} else if ( !syncCookie.ctxcsn ) {
match = 1;
} else { } else {
match = compare_csns( &syncCookie_req, &syncCookie, &m ); match = compare_csns( &syncCookie_req, &syncCookie, &m );
} }
...@@ -2608,7 +2608,7 @@ syncrepl_updateCookie( ...@@ -2608,7 +2608,7 @@ syncrepl_updateCookie(
value_add( &si->si_cookieState->cs_vals, syncCookie->ctxcsn ); value_add( &si->si_cookieState->cs_vals, syncCookie->ctxcsn );
free( si->si_cookieState->cs_sids ); free( si->si_cookieState->cs_sids );
si->si_cookieState->cs_sids = slap_parse_csn_sids( si->si_cookieState->cs_sids = slap_parse_csn_sids(
si->si_cookieState->cs_vals, si->si_cookieState->cs_num ); si->si_cookieState->cs_vals, si->si_cookieState->cs_num, NULL );
} }
si->si_cookieState->cs_age++; si->si_cookieState->cs_age++;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment