From 9e82379b6e4d0b171c72577ffb9e0582091414e9 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 19 Aug 1999 18:48:17 +0000 Subject: [PATCH] More CSRI malloc debugging support and destroy sockbuf fix. Test008 now runs without leak. --- libraries/liblber/lber-int.h | 17 +++++++++++++++++ libraries/libldif/line64.c | 7 +++++++ servers/slapd/connection.c | 1 + tests/Makefile.in | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libraries/liblber/lber-int.h b/libraries/liblber/lber-int.h index b65553571d..c1a8675eba 100644 --- a/libraries/liblber/lber-int.h +++ b/libraries/liblber/lber-int.h @@ -211,6 +211,22 @@ ber_log_sos_dump LDAP_P(( /* simple macros to realloc for now */ extern BerMemoryFunctions* ber_int_memory_fns; +#ifdef CSRIMALLOC +#define LBER_INT_MALLOC malloc +#define LBER_INT_CALLOC calloc +#define LBER_INT_REALLOC realloc +#define LBER_INT_FREE free +#define LBER_INT_VFREE ber_memvfree +#define LBER_INT_STRDUP strdup + +#define LBER_MALLOC malloc +#define LBER_CALLOC calloc +#define LBER_REALLOC realloc +#define LBER_FREE free +#define LBER_VFREE ber_memvfree +#define LBER_STRDUP strdup + +#else #define LBER_INT_MALLOC(s) ber_memalloc((s)) #define LBER_INT_CALLOC(n,s) ber_memcalloc((n),(s)) #define LBER_INT_REALLOC(p,s) ber_memrealloc((p),(s)) @@ -224,6 +240,7 @@ extern BerMemoryFunctions* ber_int_memory_fns; #define LBER_FREE(p) ber_memfree((p)) #define LBER_VFREE(v) ber_memvfree((void**)(v)) #define LBER_STRDUP(s) ber_strdup((s)) +#endif /* sockbuf.c */ diff --git a/libraries/libldif/line64.c b/libraries/libldif/line64.c index 49c884b4e2..cd84e3d26b 100644 --- a/libraries/libldif/line64.c +++ b/libraries/libldif/line64.c @@ -25,6 +25,13 @@ int ldif_debug = 0; #define RIGHT4 0x0f #define CONTINUED_LINE_MARKER '\001' +#ifdef CSRIMALLOC +#define ber_memalloc malloc +#define ber_memcalloc calloc +#define ber_memrealloc realloc +#define ber_strdup strdup +#endif + static const char nib2b64[0x40] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index a1ed6defb7..4a23bb56bd 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -115,6 +115,7 @@ int connections_destroy(void) for ( i = 0; i < dtblsize; i++ ) { if( connections[i].c_struct_state != SLAP_C_UNINITIALIZED ) { + ber_sockbuf_free( connections[i].c_sb ); ldap_pvt_thread_mutex_destroy( &connections[i].c_mutex ); ldap_pvt_thread_mutex_destroy( &connections[i].c_write_mutex ); ldap_pvt_thread_cond_destroy( &connections[i].c_write_cv ); diff --git a/tests/Makefile.in b/tests/Makefile.in index ef60166ac7..4a66102e7d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -53,7 +53,7 @@ test-nis-schema-bdb2: fi clean-local: FORCE - -$(RM) test-db/[!C]* test-repl/[!C]* *gmon *core + -$(RM) test-db/[!C]* test-repl/[!C]* *leak *gmon *core veryclean-local: FORCE @-$(RM) data -- 2.39.5