From: Ondřej Kuzník Date: Tue, 22 Oct 2024 12:59:20 +0000 (+0100) Subject: ITS#10155 manage option values more carefully X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e29105597a57af499bb6e4a642d979dd6e9d53ab;p=thirdparty%2Fopenldap.git ITS#10155 manage option values more carefully --- diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 41595e2101..3755a937d2 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -894,7 +894,7 @@ handle_private_option( int i ) break; case 'F': /* uri prefix */ if( urlpre ) free( urlpre ); - urlpre = optarg; + urlpre = strdup( optarg ); break; case 'l': /* time limit */ if ( strcasecmp( optarg, "none" ) == 0 ) { @@ -945,7 +945,7 @@ handle_private_option( int i ) break; case 'T': /* tmpdir */ if( tmpdir ) free( tmpdir ); - tmpdir = optarg; + tmpdir = strdup( optarg ); break; case 'u': /* include UFN */ ++includeufn; @@ -1660,6 +1660,9 @@ getNextPage: free( def_urlpre ); free( urlpre ); } + if ( tmpdir && tmpdir != def_tmpdir ) { + free( tmpdir ); + } if ( c ) { for ( ; save_nctrls-- > 0; ) {