Don't leak abandon mutex.
Use ch_malloc and friends.
fname, lineno, 0 );
exit( 1 );
}
- default_referral = (char *) malloc( strlen( cargv[1] )
+ default_referral = (char *) ch_malloc( strlen( cargv[1] )
+ sizeof("Referral:\n") + 1 );
strcpy( default_referral, "Referral:\n" );
strcat( default_referral, cargv[1] );
ldap_pvt_thread_mutex_lock( &arg->co_conn->c_opsmutex );
arg->co_conn->c_opscompleted++;
+
slap_op_delete( &arg->co_conn->c_ops, arg->co_op );
+ arg->co_op = NULL;
+
ldap_pvt_thread_mutex_unlock( &arg->co_conn->c_opsmutex );
+ arg->co_conn = NULL;
free( (char *) arg );
ldap_pvt_thread_mutex_lock( &ops_mutex );
free( tmpdn );
}
+ ldap_pvt_thread_mutex_lock( &active_threads_mutex );
+ active_threads++;
+ ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
+
if ( status = ldap_pvt_thread_create( &arg->co_op->o_tid, 1,
connection_operation, (void *) arg ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "ldap_pvt_thread_create failed (%d)\n", status, 0, 0 );
- } else {
- ldap_pvt_thread_mutex_lock( &active_threads_mutex );
- active_threads++;
- ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
}
}
"signaling write waiter on %d\n", i, 0, 0 );
ldap_pvt_thread_mutex_lock( &active_threads_mutex );
- ldap_pvt_thread_cond_signal( &c[i].c_wcv );
- c[i].c_writewaiter = 0;
active_threads++;
+ c[i].c_writewaiter = 0;
+ ldap_pvt_thread_cond_signal( &c[i].c_wcv );
ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
}
void
slap_op_free( Operation *op )
{
- if ( op->o_ber != NULL )
+ ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
+
+ if ( op->o_ber != NULL ) {
ber_free( op->o_ber, 1 );
+ }
if ( op->o_dn != NULL ) {
free( op->o_dn );
}
if ( op->o_ndn != NULL ) {
free( op->o_ndn );
}
- /* ldap_pvt_thread_mutex_destroy( &op->o_abandonmutex ); */
+
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+ ldap_pvt_thread_mutex_destroy( &op->o_abandonmutex );
free( (char *) op );
}
for ( tmp = olist; *tmp != NULL; tmp = &(*tmp)->o_next )
; /* NULL */
- *tmp = (Operation *) calloc( 1, sizeof(Operation) );
+ *tmp = (Operation *) ch_calloc( 1, sizeof(Operation) );
+
ldap_pvt_thread_mutex_init( &(*tmp)->o_abandonmutex );
(*tmp)->o_ber = ber;
(*tmp)->o_msgid = msgid;
if ( *tmp == NULL ) {
Debug( LDAP_DEBUG_ANY, "op_delete: can't find op %ld\n",
op->o_msgid, 0, 0 );
+ slap_op_free( op );
return;
}