[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Thu Aug 22 01:42:03 UTC 2019


The branch, master has been updated
       via  a7383889282 lib: free popt context in texpect
       via  5e1c7c084c8 s4: free popt context in dnsserver
       via  24aa50170bb s4: free popt context in utils
       via  72d3604a9c4 s4: free popt context in client
       via  42123c11c4f s4: free popt context in torture
       via  355c9f5aca2 rpcclient: free popt context when done
       via  968f7204102 s3: free popt context in utils
      from  a7e7a62f7d3 torture: fix mem leak found by ASAN (smb2_connect)

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a7383889282d3b92a9c2eaded85a5ba20e828134
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 19 13:09:25 2019 +0200

    lib: free popt context in texpect
    
    If done with popt context it should be free'd.
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Thu Aug 22 01:41:37 UTC 2019 on sn-devel-184

commit 5e1c7c084c85ea51f6843b95defee12ba6a8f0a0
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 19 14:33:33 2019 +0200

    s4: free popt context in dnsserver
    
    If done with popt context it should be free'd.
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 24aa50170bb7824c753e6b56c112cec3db02d8af
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 19 14:31:23 2019 +0200

    s4: free popt context in utils
    
    If done with popt context it should be free'd.
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 72d3604a9c4ee4325fef9b3a160445dc961c863e
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 19 14:29:22 2019 +0200

    s4: free popt context in client
    
    If done with popt context it should be free'd.
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 42123c11c4f279045189226d0a24aaa3eea5695c
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 19 14:18:06 2019 +0200

    s4: free popt context in torture
    
    If done with popt context it should be free'd.
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 355c9f5aca2af8db793bc3e695dc9b0d37e86483
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 19 14:11:54 2019 +0200

    rpcclient: free popt context when done
    
    If done with popt context it should be free'd.
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 968f72041021ccc0301220833f987dad8e3b9364
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 19 13:29:03 2019 +0200

    s3: free popt context in utils
    
    If done with popt context it should be free'd.
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/texpect/texpect.c              | 14 +++++++++-----
 source3/rpcclient/cmd_witness.c    |  1 +
 source3/utils/dbwrap_tool.c        |  1 +
 source3/utils/dbwrap_torture.c     |  1 +
 source3/utils/log2pcaphex.c        |  3 +++
 source3/utils/mvxattr.c            |  4 ++--
 source3/utils/ntlm_auth.c          |  3 +++
 source3/utils/pdbedit.c            | 14 ++++++++++++--
 source3/utils/regedit.c            |  2 ++
 source3/utils/sharesec.c           | 16 +++++++++++-----
 source3/utils/smbcontrol.c         |  2 ++
 source3/utils/smbget.c             | 17 ++++++++++++-----
 source3/utils/smbtree.c            |  2 ++
 source3/utils/split_tokens.c       |  1 +
 source3/utils/status.c             |  9 ++++++---
 source4/client/cifsdd.c            |  2 ++
 source4/dns_server/dlz_bind9.c     |  2 ++
 source4/torture/gentest.c          |  3 +++
 source4/torture/locktest.c         |  2 ++
 source4/torture/masktest.c         |  1 +
 source4/torture/smbtorture.c       |  8 ++++++++
 source4/utils/oLschema2ldif/main.c |  2 ++
 22 files changed, 88 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c
index 8ced5638c67..32b2fded410 100644
--- a/lib/texpect/texpect.c
+++ b/lib/texpect/texpect.c
@@ -401,7 +401,7 @@ int main(int argc, const char **argv)
 {
 	int optidx = 0;
 	pid_t pid;
-	poptContext pc;
+	poptContext pc = NULL;
 	const char *instruction_file;
 	const char **args;
 	const char *program;
@@ -415,7 +415,7 @@ int main(int argc, const char **argv)
 
 	if (argc == 1) {
 		poptPrintHelp(pc, stderr, 0);
-		return 1;
+		goto out;
 	}
 
 	while ((optidx = poptGetNextOpt(pc)) != -1) {
@@ -426,7 +426,7 @@ int main(int argc, const char **argv)
 	args = poptGetArgs(pc);
 	if (args == NULL) {
 		poptPrintHelp(pc, stderr, 0);
-		return 1;
+		goto out;
 	}
 
 	program_args = (char * const *)discard_const_p(char *, args);
@@ -453,7 +453,7 @@ int main(int argc, const char **argv)
 			err(1, "Failed to fork");
 
 			/* Never reached */
-			return 1;
+			goto out;
 		case 0:
 
 			if(setsid()<0)
@@ -470,7 +470,7 @@ int main(int argc, const char **argv)
 			err(1, "Failed to exec: %s", program);
 
 			/* Never reached */
-			return 1;
+			goto out;
 		default:
 			close(slave);
 			{
@@ -483,9 +483,13 @@ int main(int argc, const char **argv)
 				sigaction(SIGALRM, &sa, NULL);
 			}
 
+			poptFreeContext(pc);
 			return eval_parent(pid);
 	}
 
 	/* Never reached */
+
+out:
+	poptFreeContext(pc);
 	return 1;
 }
diff --git a/source3/rpcclient/cmd_witness.c b/source3/rpcclient/cmd_witness.c
index 733424beac3..f5f0c6293fd 100644
--- a/source3/rpcclient/cmd_witness.c
+++ b/source3/rpcclient/cmd_witness.c
@@ -213,6 +213,7 @@ static WERROR cmd_witness_Register(struct rpc_pipe_client *cli,
 	d_printf("%x:%s\n", hnd.handle_type, GUID_string(frame, &hnd.uuid));
 
 done:
+	poptFreeContext(optCon);
 	talloc_free(frame);
 	return result;
 }
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c
index 2808a5d68bf..84ff6f9d3c4 100644
--- a/source3/utils/dbwrap_tool.c
+++ b/source3/utils/dbwrap_tool.c
@@ -567,6 +567,7 @@ int main(int argc, const char **argv)
 	}
 
 done:
+	poptFreeContext(pc);
 	TALLOC_FREE(mem_ctx);
 	return ret;
 }
diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c
index 2f9e72720a3..f1cdc78d29e 100644
--- a/source3/utils/dbwrap_torture.c
+++ b/source3/utils/dbwrap_torture.c
@@ -342,6 +342,7 @@ int main(int argc, const char *argv[])
 	}
 
 done:
+	poptFreeContext(pc);
 	talloc_free(mem_ctx);
 	return ret;
 }
diff --git a/source3/utils/log2pcaphex.c b/source3/utils/log2pcaphex.c
index 70558ac5b8f..6a9b89f1c07 100644
--- a/source3/utils/log2pcaphex.c
+++ b/source3/utils/log2pcaphex.c
@@ -345,6 +345,7 @@ int main(int argc, const char **argv)
 		in  = fopen(infile, "r");
 		if(!in) {
 			perror("fopen");
+			poptFreeContext(pc);
 			return 1;
 		}
 	} else in = stdin;
@@ -356,6 +357,7 @@ int main(int argc, const char **argv)
 		if(!out) {
 			perror("fopen");
 			fprintf(stderr, "Can't find %s, using stdout...\n", outfile);
+			poptFreeContext(pc);
 			return 1;
 		}
 	}
@@ -398,5 +400,6 @@ int main(int argc, const char **argv)
 		fclose(out);
 	}
 
+	poptFreeContext(pc);
 	return 0;
 }
diff --git a/source3/utils/mvxattr.c b/source3/utils/mvxattr.c
index 1275c5c07f5..d15025b800f 100644
--- a/source3/utils/mvxattr.c
+++ b/source3/utils/mvxattr.c
@@ -108,7 +108,7 @@ int main(int argc, const char *argv[])
 {
 	int c;
 	const char *path = NULL;
-	poptContext pc;
+	poptContext pc = NULL;
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
 		{
@@ -214,9 +214,9 @@ int main(int argc, const char *argv[])
 			   state.follow_symlink ? 0 : FTW_PHYS);
 	}
 
+done:
 	poptFreeContext(pc);
 
-done:
 	TALLOC_FREE(frame);
 	return ret;
 }
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index c02e8a70a9e..a10b3ef27f1 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -2534,6 +2534,7 @@ enum {
 
 	if (argc == 1) {
 		poptPrintHelp(pc, stderr, 0);
+		poptFreeContext(pc);
 		return 1;
 	}
 
@@ -2674,6 +2675,7 @@ enum {
 
 	if (diagnostics) {
 		if (!diagnose_ntlm_auth()) {
+			poptFreeContext(pc);
 			return 1;
 		}
 	} else {
@@ -2681,6 +2683,7 @@ enum {
 
 		fstr_sprintf(user, "%s%c%s", opt_domain, winbind_separator(), opt_username);
 		if (!check_plaintext_auth(user, opt_password, True)) {
+			poptFreeContext(pc);
 			return 1;
 		}
 	}
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 74f8c3b0b2f..64ae08d4f0d 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -1186,6 +1186,7 @@ int main(int argc, const char **argv)
 	checkparms = setparms & ~MASK_ALWAYS_GOOD;
 
 	if (checkparms & BIT_FIX_INIT) {
+		poptFreeContext(pc);
 		return fix_users_list();
 	}
 
@@ -1242,6 +1243,8 @@ int main(int argc, const char **argv)
 	     (checkparms & BIT_EXPORT)) &&
 	    !(checkparms & ~(BIT_IMPORT +BIT_EXPORT +BIT_USER))) {
 
+		poptFreeContext(pc);
+
 		if (backend_in) {
 			status = make_pdb_method_name(&bin, backend_in);
 		} else {
@@ -1299,9 +1302,11 @@ int main(int argc, const char **argv)
 	/* list users operations */
 	if (checkparms & BIT_LIST) {
 		if (!(checkparms & ~BIT_LIST)) {
+			poptFreeContext(pc);
 			return print_users_list(verbose, spstyle);
 		}
 		if (!(checkparms & ~(BIT_USER + BIT_LIST))) {
+			poptFreeContext(pc);
 			return print_user_info(user_name, verbose, spstyle);
 		}
 	}
@@ -1326,12 +1331,14 @@ int main(int argc, const char **argv)
 		/* check use of -u option */
 		if (!(checkparms & BIT_USER)) {
 			fprintf (stderr, "Username not specified! (use -u option)\n");
+			poptFreeContext(pc);
 			return -1;
 		}
 
 		/* account creation operations */
 		if (!(checkparms & ~(BIT_CREATE + BIT_USER + BIT_MACHINE))) {
-		       	if (checkparms & BIT_MACHINE) {
+			poptFreeContext(pc);
+			if (checkparms & BIT_MACHINE) {
 				return new_machine(user_name, machine_sid);
 			} else {
 				return new_user(user_name, full_name,
@@ -1343,7 +1350,8 @@ int main(int argc, const char **argv)
 
 		/* account deletion operations */
 		if (!(checkparms & ~(BIT_DELETE + BIT_USER + BIT_MACHINE))) {
-		       	if (checkparms & BIT_MACHINE) {
+			poptFreeContext(pc);
+			if (checkparms & BIT_MACHINE) {
 				return delete_machine_entry(user_name);
 			} else {
 				return delete_user_entry(user_name);
@@ -1352,6 +1360,7 @@ int main(int argc, const char **argv)
 
 		/* account modification operations */
 		if (!(checkparms & ~(BIT_MODIFY + BIT_USER + BIT_MACHINE))) {
+			poptFreeContext(pc);
 			if (checkparms & BIT_MACHINE) {
 				return set_machine_info(user_name,
 							account_control,
@@ -1373,6 +1382,7 @@ int main(int argc, const char **argv)
 	}
 	poptPrintHelp(pc, stderr, 0);
 
+	poptFreeContext(pc);
 	TALLOC_FREE(frame);
 	return 1;
 }
diff --git a/source3/utils/regedit.c b/source3/utils/regedit.c
index 20115ae1624..2f5e0fcc1eb 100644
--- a/source3/utils/regedit.c
+++ b/source3/utils/regedit.c
@@ -787,6 +787,7 @@ int main(int argc, const char **argv)
 		fprintf(stderr, "Unable to open registry: %s\n",
 			win_errstr(rv));
 		TALLOC_FREE(frame);
+		poptFreeContext(pc);
 
 		return 1;
 	}
@@ -794,6 +795,7 @@ int main(int argc, const char **argv)
 	display_window(frame, ctx);
 
 	TALLOC_FREE(frame);
+	poptFreeContext(pc);
 
 	return 0;
 }
diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c
index 2ea81b9adfa..a73af180445 100644
--- a/source3/utils/sharesec.c
+++ b/source3/utils/sharesec.c
@@ -512,16 +512,19 @@ int main(int argc, const char *argv[])
 
 		if ( !sid ) {
 			fprintf( stderr, "Failed to retrieve Machine SID!\n");
-			return 3;
+			retval = 3;
+			goto done;
 		}
 
 		printf ("%s\n", dom_sid_str_buf(sid, &buf) );
-		return 0;
+		retval = 0;
+		goto done;
 	}
 
 	if ( mode == SMB_ACL_VIEW && force_acl ) {
 		fprintf( stderr, "Invalid combination of -F and -v\n");
-		return -1;
+		retval = -1;
+		goto done;
 	}
 
 	if (mode == SMB_ACL_VIEW_ALL) {
@@ -547,7 +550,8 @@ int main(int argc, const char *argv[])
 
 	if(!poptPeekArg(pc)) {
 		poptPrintUsage(pc, stderr, 0);
-		return -1;
+		retval = -1;
+		goto done;
 	}
 
 	fstrcpy(sharename, poptGetArg(pc));
@@ -556,7 +560,8 @@ int main(int argc, const char *argv[])
 
 	if ( snum == -1 && !force_acl ) {
 		fprintf( stderr, "Invalid sharename: %s\n", sharename);
-		return -1;
+		retval = -1;
+		goto done;
 	}
 
 	switch (mode) {
@@ -572,6 +577,7 @@ int main(int argc, const char *argv[])
 	}
 
 done:
+	poptFreeContext(pc);
 	talloc_destroy(ctx);
 
 	return retval;
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 1a8e59a95e2..739ee93e28b 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -1751,6 +1751,8 @@ int main(int argc, const char **argv)
          * shell needs 0. */ 
 
 	ret = !do_command(evt_ctx, msg_ctx, argc, argv);
+
+	poptFreeContext(pc);
 	TALLOC_FREE(frame);
 	return ret;
 }
diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c
index 58690be56e3..0b1de58ffa3 100644
--- a/source3/utils/smbget.c
+++ b/source3/utils/smbget.c
@@ -981,24 +981,28 @@ int main(int argc, char **argv)
 		fprintf(stderr, "%s: %s\n",
 			poptBadOption(pc, POPT_BADOPTION_NOALIAS),
 			poptStrerror(c));
-		return 1;
+		ret = 1;
+		goto done;
 	}
 
 	if ((opt.send_stdout || resume || opt.outputfile) && opt.update) {
 		fprintf(stderr, "The -o, -R or -O and -U options can not be "
 			"used together.\n");
-		return 1;
+		ret = 1;
+		goto done;
 	}
 	if ((opt.send_stdout || opt.outputfile) && recursive) {
 		fprintf(stderr, "The -o or -O and -R options can not be "
 			"used together.\n");
-		return 1;
+		ret = 1;
+		goto done;
 	}
 
 	if (opt.outputfile && opt.send_stdout) {
 		fprintf(stderr, "The -o and -O options can not be "
 			"used together.\n");
-		return 1;
+		ret = 1;
+		goto done;
 	}
 
 	popt_burn_cmdline_password(argc, argv);
@@ -1007,7 +1011,8 @@ int main(int argc, char **argv)
 
 	if (smbc_init(get_auth_data, opt.debuglevel) < 0) {
 		fprintf(stderr, "Unable to initialize libsmbclient\n");
-		return 1;
+		ret= 1;
+		goto done;
 	}
 
 	if (smb_encrypt) {
@@ -1030,6 +1035,8 @@ int main(int argc, char **argv)
 		}
 	}
 
+done:
+	poptFreeContext(pc);
 	TALLOC_FREE(frame);
 	if (ret) {
 		clean_exit();
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index 9f589b4060f..0a0dac0f9d5 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -340,11 +340,13 @@ int main(int argc, char *argv[])
 	/* Now do our stuff */
 
         if (!print_tree(popt_get_cmdline_auth_info())) {
+		poptFreeContext(pc);
 		TALLOC_FREE(frame);
                 return 1;
 	}
 
 	popt_free_cmdline_auth_info();
+	poptFreeContext(pc);
 	TALLOC_FREE(frame);
 	return 0;
 }
diff --git a/source3/utils/split_tokens.c b/source3/utils/split_tokens.c
index 98ec479ac3d..39e7396dfb3 100644
--- a/source3/utils/split_tokens.c
+++ b/source3/utils/split_tokens.c
@@ -68,6 +68,7 @@ int main(int argc, const char *argv[])
 		printf("[%s]\n", buff);
 	}
 
+	poptFreeContext(pc);
 	talloc_free(ctx);
 
 	return 0;
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 417c99ac6d9..b5d0b5e88c2 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -533,7 +533,7 @@ int main(int argc, const char *argv[])
 	bool show_processes, show_locks, show_shares;
 	bool show_notify = false;
 	bool resolve_uids = false;
-	poptContext pc;
+	poptContext pc = NULL;
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
 		{
@@ -744,11 +744,13 @@ int main(int argc, const char *argv[])
 		case 'P':
 			/* Dump profile data */
 			ok = status_profile_dump(verbose);
-			return ok ? 0 : 1;
+			ret = ok ? 0 : 1;
+			goto done;
 		case 'R':
 			/* Continuously display rate-converted data */
 			ok = status_profile_rates(verbose);
-			return ok ? 0 : 1;
+			ret = ok ? 0 : 1;
+			goto done;
 		default:
 			break;
 	}
@@ -844,6 +846,7 @@ int main(int argc, const char *argv[])
 	}
 
 done:
+	poptFreeContext(pc);
 	TALLOC_FREE(frame);
 	return ret;
 }
diff --git a/source4/client/cifsdd.c b/source4/client/cifsdd.c
index dfdaf048b3f..dadff84bda5 100644
--- a/source4/client/cifsdd.c
+++ b/source4/client/cifsdd.c
@@ -689,6 +689,8 @@ int main(int argc, const char ** argv)
 	CatchSignal(SIGINT, dd_handle_signal);
 	CatchSignal(SIGUSR1, dd_handle_signal);
 	rc = copy_files(ev, cmdline_lp_ctx);
+
+	poptFreeContext(pctx);
 	talloc_free(ev);
 	return rc;
 }
diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c
index 872eb3e0c1f..9e4a3695866 100644
--- a/source4/dns_server/dlz_bind9.c
+++ b/source4/dns_server/dlz_bind9.c
@@ -554,10 +554,12 @@ static isc_result_t parse_options(struct dlz_bind9_data *state,
 		default:
 			state->log(ISC_LOG_ERROR, "dlz_bind9: Invalid option %s: %s",
 				   poptBadOption(pc, 0), poptStrerror(opt));
+			poptFreeContext(pc);
 			return ISC_R_FAILURE;
 		}
 	}
 
+	poptFreeContext(pc);
 	return ISC_R_SUCCESS;
 }
 
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 490db6402ac..06efb882849 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -3398,6 +3398,7 @@ int main(int argc, const char *argv[])
 		const char *share = argv[1+i];


-- 
Samba Shared Repository



More information about the samba-cvs mailing list