diff options
author | Michael Adam <obnox@samba.org> | 2007-07-07 22:29:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:23:51 -0500 |
commit | cba898808e4caf7f7f622dcd9124e115babf5f5a (patch) | |
tree | 166de7c97c59c5058dc283a371753c48045e8aab /source3/utils | |
parent | c2c96bccda2b5dd9c3991ee54426f27b88812d3c (diff) | |
download | samba-cba898808e4caf7f7f622dcd9124e115babf5f5a.tar.gz samba-cba898808e4caf7f7f622dcd9124e115babf5f5a.tar.bz2 samba-cba898808e4caf7f7f622dcd9124e115babf5f5a.zip |
r23748: Clean use of talloc in import_process_service:
create a temporary talloc ctx for the function.
Michael
(This used to be commit 39df7faaa9472d565653b36203860eee8a259f2c)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_conf.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index d05a36f44d..f06a5f660d 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -536,6 +536,13 @@ static int import_process_service(TALLOC_CTX *ctx, struct registry_key *key; WERROR werr; char *valstr = NULL; + TALLOC_CTX *tmp_ctx = NULL; + + tmp_ctx = talloc_new(ctx); + if (tmp_ctx == NULL) { + werr = WERR_NOMEM; + goto done; + } servicename = (share->service == GLOBAL_SECTION_SNUM)? GLOBAL_NAME : lp_servicename(share->service); @@ -544,13 +551,13 @@ static int import_process_service(TALLOC_CTX *ctx, d_printf("[%s]\n", servicename); } else { - if (smbconf_key_exists(ctx, servicename)) { - werr = reg_delkey_internal(ctx, servicename); + if (smbconf_key_exists(tmp_ctx, servicename)) { + werr = reg_delkey_internal(tmp_ctx, servicename); if (!W_ERROR_IS_OK(werr)) { goto done; } } - werr = reg_createkey_internal(ctx, servicename, &key); + werr = reg_createkey_internal(tmp_ctx, servicename, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -562,7 +569,7 @@ static int import_process_service(TALLOC_CTX *ctx, && !(parm->flags & FLAG_GLOBAL)) continue; - valstr = parm_valstr(ctx, parm, share); + valstr = parm_valstr(tmp_ctx, parm, share); if (parm->type != P_SEP) { if (opt_testmode) { @@ -583,7 +590,9 @@ static int import_process_service(TALLOC_CTX *ctx, } ret = 0; + done: + TALLOC_FREE(tmp_ctx); return ret; } |