diff options
author | Andrew Bartlett <abartlet@samba.org> | 2014-03-31 10:28:29 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-05-07 19:49:18 +0200 |
commit | 9fdcf7888b9cf35cdb799414153e6b6be5cc0d88 (patch) | |
tree | 15f2f5fd5ba403dbe61903d237d2304038e5ccd4 | |
parent | fa48d527b565838b3d29b567ae5bc9be8395d8dc (diff) | |
download | samba-9fdcf7888b9cf35cdb799414153e6b6be5cc0d88.tar.gz samba-9fdcf7888b9cf35cdb799414153e6b6be5cc0d88.tar.xz samba-9fdcf7888b9cf35cdb799414153e6b6be5cc0d88.zip |
param: Use an explicit talloc_stackframe() in lp_do_parameter for clarity and certainty.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/param/loadparm.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 52dc57db40..9c3119fb50 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2556,6 +2556,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue void *parm_ptr = NULL; /* where we are going to store the result */ struct parmlist_entry **opt_list; TALLOC_CTX *mem_ctx; + TALLOC_CTX *frame = talloc_stackframe(); parmnum = lpcfg_map_parameter(pszParmName); @@ -2563,6 +2564,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue if (strchr(pszParmName, ':') == NULL) { DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName)); + TALLOC_FREE(frame); return true; } @@ -2578,12 +2580,14 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue set_param_opt(ServicePtrs[snum], opt_list, pszParmName, pszParmValue, 0); } + TALLOC_FREE(frame); return true; } /* if it's already been set by the command line, then we don't override here */ if (parm_table[parmnum].flags & FLAG_CMDLINE) { + TALLOC_FREE(frame); return true; } @@ -2600,6 +2604,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue DEBUG(0, ("Global parameter %s found in service section!\n", pszParmName)); + TALLOC_FREE(frame); return true; } parm_ptr = lp_local_ptr_by_snum(snum, &parm_table[parmnum]); @@ -2625,14 +2630,13 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue /* if it is a special case then go ahead */ if (parm_table[parmnum].special) { bool ok; - struct loadparm_context *lp_ctx = loadparm_init_s3(talloc_tos(), + struct loadparm_context *lp_ctx = loadparm_init_s3(frame, loadparm_s3_helpers()); lp_ctx->sDefault = &sDefault; lp_ctx->services = ServicePtrs; ok = parm_table[parmnum].special(lp_ctx, snum, pszParmValue, (char **)parm_ptr); - TALLOC_FREE(lp_ctx); - + TALLOC_FREE(frame); return ok; } @@ -2659,6 +2663,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue i = sscanf(pszParmValue, "%o", (int *)parm_ptr); if ( i != 1 ) { DEBUG ( 0, ("Invalid octal number %s\n", pszParmName )); + TALLOC_FREE(frame); return false; } break; @@ -2699,6 +2704,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue } case P_ENUM: if (!lp_set_enum_parm(&parm_table[parmnum], pszParmValue, (int*)parm_ptr)) { + TALLOC_FREE(frame); return false; } break; @@ -2706,6 +2712,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue break; } + TALLOC_FREE(frame); return true; } |