]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4: free popt context in torture
authorSwen Schillig <swen@linux.ibm.com>
Mon, 19 Aug 2019 12:18:06 +0000 (14:18 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 22 Aug 2019 00:21:50 +0000 (00:21 +0000)
If done with popt context it should be free'd.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
source4/torture/gentest.c
source4/torture/locktest.c
source4/torture/masktest.c
source4/torture/smbtorture.c

index 490db6402ac214f9daa563d2ebedc7535466cfe7..06efb882849c8a54ff65fe958c37be58d1ab4b1c 100644 (file)
@@ -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;
 }
index 704755464ed016fe15119eef7dd35190ef7f6ecb..546231fabec5da069791a77f502cbb7c9e5966a8 100644 (file)
@@ -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;
 }
index 9a047e2b70809b05348af79f92cbcb374d58ba21..5b9d1b2901f1d38528eeb812011c16b45d45a5d2 100644 (file)
@@ -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);
 }
index 018f39f00d9ee42e6000ce6cf09f9f71cd76b30a..90b2b04cd88b6a8790b3881c43c061e204793117 100644 (file)
@@ -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);
        }