From: Swen Schillig Date: Mon, 19 Aug 2019 12:18:06 +0000 (+0200) Subject: s4: free popt context in torture X-Git-Tag: tevent-0.10.1~224 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42123c11c4f279045189226d0a24aaa3eea5695c;p=thirdparty%2Fsamba.git s4: free popt context in torture If done with popt context it should be free'd. Signed-off-by: Swen Schillig Reviewed-by: Andrew Bartlett Reviewed-by: Ralph Böhme --- 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]; if (!split_unc_name(share, &servers[i].server_name, &servers[i].share_name)) { printf("Invalid share name '%s'\n", share); + poptFreeContext(pc); talloc_free(mem_ctx); return -1; } @@ -3405,6 +3406,7 @@ int main(int argc, const char *argv[]) if (username_count == 0) { usage(pc); + poptFreeContext(pc); talloc_free(mem_ctx); return -1; } @@ -3426,6 +3428,7 @@ int main(int argc, const char *argv[]) printf("gentest failed\n"); } + poptFreeContext(pc); talloc_free(mem_ctx); return ret?0:-1; } diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 704755464ed..546231fabec 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -645,6 +645,7 @@ int main(int argc, const char *argv[]) if (username_count == 0) { usage(pc); + poptFreeContext(pc); return -1; } if (username_count == 1) { @@ -660,6 +661,7 @@ int main(int argc, const char *argv[]) srandom(seed); ret = test_locks(ev, lp_ctx, NULL, share); + poptFreeContext(pc); talloc_free(mem_ctx); return ret; } diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index 9a047e2b708..5b9d1b2901f 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -387,6 +387,7 @@ int main(int argc, const char *argv[]) test_mask(argc_new-1, argv_new+1, mem_ctx, cli); + poptFreeContext(pc); talloc_free(mem_ctx); return(0); } diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 018f39f00d9..90b2b04cd88 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -587,6 +587,7 @@ int main(int argc, const char *argv[]) if (list_testsuites) { print_testsuite_list(); + poptFreeContext(pc); talloc_free(mem_ctx); popt_free_cmdline_credentials(); return 0; @@ -610,6 +611,7 @@ int main(int argc, const char *argv[]) print_test_list(torture_root, NULL, argv_new[i]); } } + poptFreeContext(pc); talloc_free(mem_ctx); popt_free_cmdline_credentials(); return 0; @@ -638,6 +640,7 @@ int main(int argc, const char *argv[]) if (basedir != NULL) { if (basedir[0] != '/') { fprintf(stderr, "Please specify an absolute path to --basedir\n"); + poptFreeContext(pc); talloc_free(mem_ctx); return 1; } @@ -646,6 +649,7 @@ int main(int argc, const char *argv[]) char *pwd = talloc_size(torture, PATH_MAX); if (!getcwd(pwd, PATH_MAX)) { fprintf(stderr, "Unable to determine current working directory\n"); + poptFreeContext(pc); talloc_free(mem_ctx); return 1; } @@ -653,12 +657,14 @@ int main(int argc, const char *argv[]) } if (!outputdir) { fprintf(stderr, "Could not allocate per-run output dir\n"); + poptFreeContext(pc); talloc_free(mem_ctx); return 1; } torture->outputdir = mkdtemp(outputdir); if (!torture->outputdir) { perror("Failed to make temp output dir"); + poptFreeContext(pc); talloc_free(mem_ctx); return 1; } @@ -700,10 +706,12 @@ int main(int argc, const char *argv[]) torture_deltree_outputdir(torture); if (torture->results->returncode && correct) { + poptFreeContext(pc); talloc_free(mem_ctx); popt_free_cmdline_credentials(); return(0); } else { + poptFreeContext(pc); talloc_free(mem_ctx); return(1); }