From: Howard Chu Date: Fri, 5 Nov 1999 22:50:58 +0000 (+0000) Subject: Fix - v2ref returned a pointer that it did not allocate, and send_ldap_result X-Git-Tag: UCDATA_2_4~239 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fe79f5d12a4d97d360a683b1186bc78a7707d304;p=openldap Fix - v2ref returned a pointer that it did not allocate, and send_ldap_result would try to free it. Also, send_search_result was not freeing the pointer, but it should have been. --- diff --git a/servers/slapd/result.c b/servers/slapd/result.c index fbb668baec..9014ed7a1c 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -23,8 +23,14 @@ static char *v2ref( struct berval **ref, const char *text ) size_t len = 0, i = 0; char *v2; - if(ref == NULL) return (char *)text; - + if(ref == NULL) + { + if (text) + return ch_strdup(text); + else + return NULL; + } + if (text) { len = strlen( text ); if (text[len-1] != '\n') @@ -428,7 +434,7 @@ send_ldap_result( (long) tag, (long) err, text ? text : "" ); if( tmp != NULL ) { - free(tmp); + ch_free(tmp); } } @@ -499,6 +505,8 @@ send_search_result( (long) op->o_connid, (long) op->o_opid, (long) tag, (long) err, text ? text : "" ); + if (tmp != NULL) + ch_free(tmp); }