From 97e5524af912046ddd683bd23d5dd917d019b103 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 20 May 1999 21:53:56 +0000 Subject: [PATCH] found my lber bug... ber_buf should have been freed in ber_peek_tag. Ugh! --- clients/tools/ldapsearch.c | 2 ++ include/lber.h | 2 +- libraries/liblber/decode.c | 2 +- libraries/liblber/io.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 315a6ad60d..83b1720e76 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -382,6 +382,7 @@ static int dosearch( matches = 0; first = 1; + res = NULL; while ( (rc = ldap_result( ld, LDAP_RES_ANY, sortattr ? 1 : 0, NULL, &res )) == LDAP_RES_SEARCH_ENTRY ) { matches++; @@ -393,6 +394,7 @@ static int dosearch( } print_entry( ld, e, attrsonly ); ldap_msgfree( res ); + res = NULL; } if ( rc == -1 ) { ldap_perror( ld, "ldap_result" ); diff --git a/include/lber.h b/include/lber.h index 20fd9c51ad..6bf7b8189d 100644 --- a/include/lber.h +++ b/include/lber.h @@ -67,7 +67,7 @@ LDAP_BEGIN_DECL #define LBER_INVALID(tag) ( ( (tag) & 0xFFFFFF80UL ) != 0 ) #define LBER_ERROR 0xffffffffUL #define LBER_DEFAULT 0xffffffffUL -/* #define LBER_END_SEQORSET 0xfffffffeUL *//* not part of LDAP C-API */ +#define LBER_END_SEQORSET 0xfffffffeUL /* not part of LDAP C-API */ /* general BER types we know about */ #define LBER_BOOLEAN 0x01UL diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c index 2e8bf8b330..aa33b44dad 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -139,7 +139,7 @@ ber_peek_tag( tag = ber_skip_tag( ber, len ); - ber_free( ber, 1 ); + ber_free( ber, 0 ); return( tag ); } diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 176a965fb0..d71693d7f3 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -443,7 +443,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber ) */ if (ber->ber_rwptr == NULL) { - /* assert( ber->ber_buf == NULL ); */ + assert( ber->ber_buf == NULL ); ber->ber_rwptr = (char *) &ber->ber_tag; ber->ber_tag = 0; } -- 2.39.5