]> git.sur5r.net Git - openldap/commitdiff
ITS#6005 strings returned to slapd must use ber_mem*
authorHoward Chu <hyc@openldap.org>
Sun, 8 Mar 2009 00:11:25 +0000 (00:11 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 8 Mar 2009 00:11:25 +0000 (00:11 +0000)
libraries/liblutil/passfile.c

index 3c44e91a4f3492479efb3df6d106fa5f1421579d..7e7edbaf0b86537621f74ee04881cb362964abac 100644 (file)
@@ -62,7 +62,7 @@ lutil_get_filed_password(
        }
 #endif /* HAVE_FSTAT */
 
-       passwd->bv_val = (char *) malloc( passwd->bv_len + 1 );
+       passwd->bv_val = (char *) ber_memalloc( passwd->bv_len + 1 );
        if( passwd->bv_val == NULL ) {
                perror( filename );
                return -1;
@@ -73,10 +73,10 @@ lutil_get_filed_password(
        do {
                if( nleft == 0 ) {
                        /* double the buffer size */
-                       char *p = (char *) realloc( passwd->bv_val,
+                       char *p = (char *) ber_memrealloc( passwd->bv_val,
                                2 * passwd->bv_len + 1 );
                        if( p == NULL ) {
-                               free( passwd->bv_val );
+                               ber_memfree( passwd->bv_val );
                                passwd->bv_val = NULL;
                                passwd->bv_len = 0;
                                return -1;
@@ -89,7 +89,7 @@ lutil_get_filed_password(
                nr = fread( &passwd->bv_val[nread], 1, nleft, f );
 
                if( nr < nleft && ferror( f ) ) {
-                       free( passwd->bv_val );
+                       ber_memfree( passwd->bv_val );
                        passwd->bv_val = NULL;
                        passwd->bv_len = 0;
                        return -1;