]> git.sur5r.net Git - openldap/commitdiff
Fix - v2ref returned a pointer that it did not allocate, and send_ldap_result
authorHoward Chu <hyc@openldap.org>
Fri, 5 Nov 1999 22:50:58 +0000 (22:50 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 5 Nov 1999 22:50:58 +0000 (22:50 +0000)
would try to free it. Also, send_search_result was not freeing the pointer,
but it should have been.

servers/slapd/result.c

index fbb668baecb3a34c07368bcf9192d6792d360380..9014ed7a1c7f426b4971af2f38120a63b7c3ad2b 100644 (file)
@@ -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);
 }