From: Luke Howard Date: Tue, 9 Aug 2005 02:56:21 +0000 (+0000) Subject: Fix slapi_str2entry()/slapi_entry2str() allocation X-Git-Tag: OPENLDAP_AC_BP~32 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2e36d49a7312e73de1a68c19facabb480590da88;p=openldap Fix slapi_str2entry()/slapi_entry2str() allocation --- diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 8e7b656468..ca370dd483 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -110,16 +110,7 @@ slapi_str2entry( char *s, int flags ) { - Slapi_Entry *e = NULL; - char *pTmpS; - - pTmpS = slapi_ch_strdup( s ); - if ( pTmpS != NULL ) { - e = str2entry( pTmpS ); - slapi_ch_free( (void **)&pTmpS ); - } - - return e; + return str2entry( s ); } char * @@ -127,10 +118,13 @@ slapi_entry2str( Slapi_Entry *e, int *len ) { - char *ret; + char *ret = NULL; + char *s; ldap_pvt_thread_mutex_lock( &entry2str_mutex ); - ret = entry2str( e, len ); + s = entry2str( e, len ); + if ( s != NULL ) + ret = slapi_ch_strdup( s ); ldap_pvt_thread_mutex_unlock( &entry2str_mutex ); return ret;