From a286d071099a572a585c5b162b1e455ae28336c2 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 1 Aug 2005 03:44:52 +0000 Subject: [PATCH] Plug memory leaks --- clients/tools/common.c | 6 ++++++ clients/tools/ldapmodify.c | 3 +++ clients/tools/ldapsearch.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/clients/tools/common.c b/clients/tools/common.c index c076b9f65a..78b713771c 100644 --- a/clients/tools/common.c +++ b/clients/tools/common.c @@ -717,6 +717,9 @@ tool_args( int argc, char **argv ) LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION ); if (version > 1) exit( EXIT_SUCCESS ); } + + ldap_memfree( api.ldapai_vendor_name ); + ldap_value_free( api.ldapai_extensions ); } if (protocol == -1) @@ -971,6 +974,9 @@ tool_bind( LDAP *ld ) } } #endif + if ( ctrls ) { + ldap_controls_free( ctrls ); + } if ( err != LDAP_SUCCESS || msgbuf[0] ) { fprintf( stderr, "ldap_bind: %s%s\n", ldap_err2string( err ), msgbuf ); diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index de2513ca26..d1941e3bb8 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -720,6 +720,9 @@ end_line: if ( newrdn != NULL ) { free( newrdn ); } + if ( newsup != NULL ) { + free( newsup ); + } if ( pmods != NULL ) { ldap_mods_free( pmods, 1 ); } diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 29bd04c939..86b1c404a7 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -603,7 +603,7 @@ main( int argc, char **argv ) { filtpattern = "(objectclass=*)"; } else { - filtpattern = strdup( argv[optind++] ); + filtpattern = argv[optind++]; } if ( argv[optind] != NULL ) { -- 2.39.5