1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s4: torture: Use a named TALLOC_CTX in masktest instead of talloc_autofree_context().

Move all talloc_free()'s back to main from the function call.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2017-04-24 16:11:22 -07:00
parent 47d74639d9
commit fa88c5da46

View File

@ -268,7 +268,6 @@ static void test_mask(int argc, char *argv[],
finished:
smbcli_rmdir(cli->tree, "\\masktest");
talloc_free(mem_ctx);
}
@ -300,7 +299,7 @@ int main(int argc, const char *argv[])
poptContext pc;
int argc_new, i;
char **argv_new;
TALLOC_CTX *mem_ctx;
TALLOC_CTX *mem_ctx = NULL;
enum {OPT_UNCLIST=1000};
struct poptOption long_options[] = {
POPT_AUTOHELP
@ -322,6 +321,11 @@ int main(int argc, const char *argv[])
setlinebuf(stdout);
seed = time(NULL);
mem_ctx = talloc_named_const(NULL, 0, "masktest_ctx");
if (mem_ctx == NULL) {
exit(1);
}
pc = poptGetContext("locktest", argc, argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
@ -346,6 +350,7 @@ int main(int argc, const char *argv[])
if (!(argc_new >= 2)) {
usage(pc);
talloc_free(mem_ctx);
exit(1);
}
@ -357,8 +362,6 @@ int main(int argc, const char *argv[])
lp_ctx = cmdline_lp_ctx;
mem_ctx = talloc_autofree_context();
ev = s4_event_context_init(mem_ctx);
gensec_init();
@ -372,6 +375,7 @@ int main(int argc, const char *argv[])
lpcfg_gensec_settings(mem_ctx, lp_ctx));
if (!cli) {
DEBUG(0,("Failed to connect to %s\n", share));
talloc_free(mem_ctx);
exit(1);
}
@ -381,5 +385,6 @@ int main(int argc, const char *argv[])
test_mask(argc_new-1, argv_new+1, mem_ctx, cli);
talloc_free(mem_ctx);
return(0);
}