/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2004 The OpenLDAP Foundation.
+ * Copyright 2000-2011 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#ifdef USE_REWRITE_LDAP_PVT_THREADS
if ( ldap_pvt_thread_rdwr_init( &info->li_cookies_mutex ) ) {
+ avl_free( info->li_context, rewrite_context_free );
free( info );
return NULL;
}
if ( ldap_pvt_thread_rdwr_init( &info->li_params_mutex ) ) {
+ ldap_pvt_thread_rdwr_destroy( &info->li_cookies_mutex );
+ avl_free( info->li_context, rewrite_context_free );
free( info );
return NULL;
}
if ( info->li_maps ) {
avl_free( info->li_maps, rewrite_builtin_map_free );
}
- info->li_context = NULL;
+ info->li_maps = NULL;
rewrite_session_destroy( info );
case REWRITE_MODE_COPY_INPUT:
*result = strdup( string );
- rc = REWRITE_REGEXEC_OK;
+ rc = ( *result != NULL ) ? REWRITE_REGEXEC_OK : REWRITE_REGEXEC_ERR;
goto rc_return;
case REWRITE_MODE_USE_DEFAULT:
case REWRITE_REGEXEC_UNWILLING:
case REWRITE_REGEXEC_ERR:
if ( *result != NULL ) {
- free( *result );
+ if ( *result != string ) {
+ free( *result );
+ }
*result = NULL;
}