Commit 8fb0e066 authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

ITS#6005

parent 39016bc3
......@@ -20,6 +20,8 @@ OpenLDAP 2.4.16 Engineering
Fixed slapo-dynlist conversion to cn=config (ITS#6002)
Fixed slapo-syncprov newCookie sync messages (ITS#5972)
Fixed slapo-syncprov multiple CSN propagation (ITS#5973)
Build Environment
Cleaned up alloc/free functions for Windows (ITS#6005)
Documentation
admin24 clarified MMR URI requirements (ITS#5942,ITS#5987)
Added ldapexop(1) manual page (ITS#5982)
......
......@@ -623,7 +623,7 @@ tool_args( int argc, char **argv )
} else if ( tool_is_oid( control ) ) {
LDAPControl *tmpctrls, ctrl;
tmpctrls = (LDAPControl *)realloc( unknown_ctrls,
tmpctrls = (LDAPControl *)ber_memrealloc( unknown_ctrls,
(unknown_ctrls_num + 1)*sizeof( LDAPControl ) );
if ( tmpctrls == NULL ) {
fprintf( stderr, "%s: no memory?\n", prog );
......@@ -1169,7 +1169,7 @@ tool_conn_setup( int dont, void (*private_setup)( LDAP * ) )
for ( i = 0; hosts[ i ] != NULL; i++ )
/* count'em */ ;
tmp = (char **)realloc( urls, sizeof( char * ) * ( nurls + i + 1 ) );
tmp = (char **)ber_memrealloc( urls, sizeof( char * ) * ( nurls + i + 1 ) );
if ( tmp == NULL ) {
fprintf( stderr,
"DNS SRV: out of memory?\n" );
......@@ -1203,7 +1203,7 @@ dnssrv_free:;
ber_memfree( domain );
} else {
tmp = (char **)realloc( urls, sizeof( char * ) * ( nurls + 2 ) );
tmp = (char **)ber_memrealloc( urls, sizeof( char * ) * ( nurls + 2 ) );
if ( tmp == NULL ) {
fprintf( stderr,
"DNS SRV: out of memory?\n" );
......
......@@ -379,7 +379,7 @@ main( int argc, char *argv[] )
perror( "ber_scanf" );
} else {
printf(_("New password: %s\n"), s);
free( s );
ber_memfree( s );
}
ber_free( ber, 1 );
......
......@@ -1024,8 +1024,8 @@ getNextPage:
tool_server_controls( ld, c, i );
ber_free( seber, 1 );
ber_free( vrber, 1 );
if ( seber ) ber_free( seber, 1 );
if ( vrber ) ber_free( vrber, 1 );
/* step back to the original number of controls, so that
* those set while parsing args are preserved */
......
......@@ -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;
......
......@@ -1107,7 +1107,7 @@ static int hash_crypt(
int lutil_salt_format(const char *format)
{
#ifdef SLAPD_CRYPT
free( salt_format );
ber_memfree( salt_format );
salt_format = format != NULL ? ber_strdup( format ) : NULL;
#endif
......
......@@ -39,6 +39,13 @@
#include <rewrite.h>
#define malloc(x) ber_memalloc(x)
#define calloc(x,y) ber_memcalloc(x,y)
#define realloc(x,y) ber_memrealloc(x,y)
#define free(x) ber_memfree(x)
#undef strdup
#define strdup(x) ber_strdup(x)
/* Uncomment to use ldap pvt threads */
#define USE_REWRITE_LDAP_PVT_THREADS
#include <ldap_pvt_thread.h>
......
......@@ -23,6 +23,7 @@
#if SLAPD_BDB || SLAPD_HDB
#include <lber.h>
#include "alock.h"
#include "lutil.h"
......@@ -238,8 +239,8 @@ alock_read_slot ( alock_info_t * info,
slot_data->al_stamp = alock_read_iattr (slotbuf+16);
slot_data->al_pid = alock_read_iattr (slotbuf+24);
if (slot_data->al_appname) free (slot_data->al_appname);
slot_data->al_appname = calloc (1, ALOCK_MAX_APPNAME);
if (slot_data->al_appname) ber_memfree (slot_data->al_appname);
slot_data->al_appname = ber_memcalloc (1, ALOCK_MAX_APPNAME);
if (slot_data->al_appname == NULL) {
return -1;
}
......@@ -306,7 +307,7 @@ alock_query_slot ( alock_info_t * info )
(void) memset ((void *) &slot_data, 0, sizeof (alock_slot_t));
alock_read_slot (info, &slot_data);
if (slot_data.al_appname != NULL) free (slot_data.al_appname);
if (slot_data.al_appname != NULL) ber_memfree (slot_data.al_appname);
slot_data.al_appname = NULL;
nosave = slot_data.al_lock & ALOCK_NOSAVE;
......@@ -349,24 +350,24 @@ alock_open ( alock_info_t * info,
slot_data.al_lock = locktype;
slot_data.al_stamp = time(NULL);
slot_data.al_pid = getpid();
slot_data.al_appname = calloc (1, ALOCK_MAX_APPNAME);
slot_data.al_appname = ber_memcalloc (1, ALOCK_MAX_APPNAME);
if (slot_data.al_appname == NULL) {
return ALOCK_UNSTABLE;
}
strncpy (slot_data.al_appname, appname, ALOCK_MAX_APPNAME-1);
slot_data.al_appname [ALOCK_MAX_APPNAME-1] = '\0';
filename = calloc (1, strlen (envdir) + strlen ("/alock") + 1);
filename = ber_memcalloc (1, strlen (envdir) + strlen ("/alock") + 1);
if (filename == NULL ) {
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
ptr = lutil_strcopy(filename, envdir);
lutil_strcopy(ptr, "/alock");
info->al_fd = open (filename, O_CREAT|O_RDWR, 0666);
free (filename);
ber_memfree (filename);
if (info->al_fd < 0) {
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
info->al_slot = 0;
......@@ -374,14 +375,14 @@ alock_open ( alock_info_t * info,
res = alock_grab_lock (info->al_fd, 0);
if (res == -1) {
close (info->al_fd);
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
res = fstat (info->al_fd, &statbuf);
if (res == -1) {
close (info->al_fd);
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
......@@ -410,7 +411,7 @@ alock_open ( alock_info_t * info,
} else if (res == ALOCK_UNIQUE
&& locktype == ALOCK_UNIQUE) {
close (info->al_fd);
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_BUSY;
} else if (res == ALOCK_DIRTY) {
......@@ -418,7 +419,7 @@ alock_open ( alock_info_t * info,
} else if (res == -1) {
close (info->al_fd);
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
......@@ -427,7 +428,7 @@ alock_open ( alock_info_t * info,
if (dirty_count && live_count) {
close (info->al_fd);
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
......@@ -436,11 +437,11 @@ alock_open ( alock_info_t * info,
info->al_slot);
if (res == -1) {
close (info->al_fd);
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
res = alock_write_slot (info, &slot_data);
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
if (res == -1) {
close (info->al_fd);
return ALOCK_UNSTABLE;
......@@ -549,7 +550,7 @@ alock_close ( alock_info_t * info, int nosave )
if (res == -1) {
close (info->al_fd);
if (slot_data.al_appname != NULL)
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
slot_data.al_lock = ALOCK_UNLOCKED;
......@@ -559,11 +560,11 @@ alock_close ( alock_info_t * info, int nosave )
if (res == -1) {
close (info->al_fd);
if (slot_data.al_appname != NULL)
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
if (slot_data.al_appname != NULL) {
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
slot_data.al_appname = NULL;
}
......@@ -635,11 +636,11 @@ alock_recover ( alock_info_t * info )
if (res == -1) {
close (info->al_fd);
if (slot_data.al_appname != NULL)
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
return ALOCK_UNSTABLE;
}
if (slot_data.al_appname != NULL) {
free (slot_data.al_appname);
ber_memfree (slot_data.al_appname);
slot_data.al_appname = NULL;
}
......
......@@ -195,7 +195,7 @@ slap_sl_mem_create(
if (size > (char *)sh->sh_end - (char *)sh->sh_base) {
void *newptr;
newptr = realloc( sh->sh_base, size );
newptr = ch_realloc( sh->sh_base, size );
if ( newptr == NULL ) return NULL;
sh->sh_base = newptr;
}
......
......@@ -591,7 +591,7 @@ novals:;
if ( dns ) {
for ( i = 0; i < ndns; i++ ) {
free( dns[i] );
ber_memfree( dns[i] );
}
free( dns );
}
......@@ -599,7 +599,7 @@ novals:;
if ( creds ) {
for ( i = 0; i < ndns; i++ ) {
if ( creds[i].bv_val != nullstr ) {
free( creds[i].bv_val );
ber_memfree( creds[i].bv_val );
}
}
free( creds );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment