session = calloc( sizeof( struct rewrite_session ), 1 );
if ( session == NULL ) {
+#ifdef USE_REWRITE_LDAP_PVT_THREADS
+ ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
+#endif /* USE_REWRITE_LDAP_PVT_THREADS */
return NULL;
}
session->ls_cookie = ( void * )cookie;
#ifdef USE_REWRITE_LDAP_PVT_THREADS
if ( ldap_pvt_thread_mutex_init( &session->ls_mutex ) ) {
free( session );
+ ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
return NULL;
}
if ( ldap_pvt_thread_rdwr_init( &session->ls_vars_mutex ) ) {
ldap_pvt_thread_mutex_destroy( &session->ls_mutex );
free( session );
+ ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
return NULL;
}
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
info->li_num_cookies++;
#ifdef USE_REWRITE_LDAP_PVT_THREADS
- ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
+ ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
if ( rc != 0 ) {
&& ( p = strtok( NULL, "" ) ) ) {
val->bv_val = strdup( p );
if ( val->bv_val == NULL ) {
- return REWRITE_ERR;
+#ifdef USE_REWRITE_LDAP_PVT_THREADS
+ ldap_pvt_thread_mutex_unlock( &map->lm_mutex );
+#endif /* USE_REWRITE_LDAP_PVT_THREADS */
+ rc = REWRITE_ERR;
+ goto rc_return;
}
val->bv_len = strlen( p );