X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Foperation.c;h=2fff851887656720e1705ec74cb54f7982fbf770;hb=d2d574858005d9f81129a7502b663a5cd9c0f22d;hp=47d084d6b494a5c818a82a9fb15bd1649e504a87;hpb=d0516836b57d967d2ae604deef528f5f55518d7a;p=openldap diff --git a/servers/slapd/operation.c b/servers/slapd/operation.c index 47d084d6b4..2fff851887 100644 --- a/servers/slapd/operation.c +++ b/servers/slapd/operation.c @@ -13,12 +13,20 @@ 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 ); } - /* pthread_mutex_destroy( &op->o_abandonmutex ); */ + if ( op->o_ndn != NULL ) { + free( op->o_ndn ); + } + + ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex ); + ldap_pvt_thread_mutex_destroy( &op->o_abandonmutex ); free( (char *) op ); } @@ -38,17 +46,20 @@ slap_op_add( for ( tmp = olist; *tmp != NULL; tmp = &(*tmp)->o_next ) ; /* NULL */ - *tmp = (Operation *) calloc( 1, sizeof(Operation) ); - pthread_mutex_init( &(*tmp)->o_abandonmutex, - pthread_mutexattr_default ); + *tmp = (Operation *) ch_calloc( 1, sizeof(Operation) ); + + ldap_pvt_thread_mutex_init( &(*tmp)->o_abandonmutex ); (*tmp)->o_ber = ber; (*tmp)->o_msgid = msgid; (*tmp)->o_tag = tag; (*tmp)->o_abandon = 0; + (*tmp)->o_dn = ch_strdup( dn != NULL ? dn : "" ); - pthread_mutex_lock( ¤ttime_mutex ); + (*tmp)->o_ndn = dn_normalize_case( ch_strdup( (*tmp)->o_dn ) ); + + ldap_pvt_thread_mutex_lock( ¤ttime_mutex ); (*tmp)->o_time = currenttime; - pthread_mutex_unlock( ¤ttime_mutex ); + ldap_pvt_thread_mutex_unlock( ¤ttime_mutex ); (*tmp)->o_opid = id; (*tmp)->o_connid = connid; (*tmp)->o_next = NULL; @@ -67,6 +78,7 @@ slap_op_delete( Operation **olist, Operation *op ) 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; }