]> git.sur5r.net Git - openldap/commitdiff
fix one-time leaks
authorPierangelo Masarati <ando@openldap.org>
Sat, 15 Dec 2007 11:51:20 +0000 (11:51 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 15 Dec 2007 11:51:20 +0000 (11:51 +0000)
clients/tools/common.c
clients/tools/ldapsearch.c

index 6fb304a6ec96ef3705ed88fb4afef40d11404a89..cfbe29bf9aa7726cd9c6026f4de319c2495f853b 100644 (file)
@@ -223,6 +223,17 @@ tool_destroy( void )
 #ifdef HAVE_TLS
        ldap_pvt_tls_destroy();
 #endif
+
+       if ( ldapuri != NULL ) {
+               ber_memfree( ldapuri );
+               ldapuri = NULL;
+       }
+
+       if ( pr_cookie.bv_val != NULL ) {
+               ber_memfree( pr_cookie.bv_val );
+               pr_cookie.bv_val = NULL;
+               pr_cookie.bv_len = 0;
+       }
 }
 
 void
index f5312a27b840c3567f21bd4c75565a7def8092a4..6ca5d274ddcb8178ccd86e7b2f1566dfeb14f472 100644 (file)
@@ -95,6 +95,8 @@ static int attrsonly;
 static int timelimit = -1;
 static int sizelimit = -1;
 
+static char *control;
+
 static char *def_tmpdir;
 static char *def_urlpre;
 
@@ -255,7 +257,7 @@ int
 handle_private_option( int i )
 {
        int crit, ival;
-       char *control, *cvalue, *next;
+       char *cvalue, *next;
        switch ( i ) {
        case 'a':       /* set alias deref option */
                if ( strcasecmp( optarg, "never" ) == 0 ) {
@@ -1040,6 +1042,12 @@ getNextPage:
 
        tool_unbind( ld );
        tool_destroy();
+       if ( base != NULL ) {
+               ber_memfree( base );
+       }
+       if ( control != NULL ) {
+               ber_memfree( control );
+       }
 
        if ( c ) {
                for ( ; save_nctrls-- > 0; ) {