diff options
author | Michael Adam <obnox@samba.org> | 2008-03-28 15:49:13 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-03-28 16:34:51 +0100 |
commit | 9644b6cb50ec01c04a0d6ab17a8e39054fd8b0f8 (patch) | |
tree | d000e447b508b5a8c282957f5b7921e768da0884 /source3/web | |
parent | cc2f5fd1b5aa7e7a7277557edfd4b94b0d10661d (diff) | |
download | samba-9644b6cb50ec01c04a0d6ab17a8e39054fd8b0f8.tar.gz samba-9644b6cb50ec01c04a0d6ab17a8e39054fd8b0f8.tar.bz2 samba-9644b6cb50ec01c04a0d6ab17a8e39054fd8b0f8.zip |
Add a talloc context parameter to current_timestring() to fix memleaks.
current_timestring used to return a string talloced to talloc_tos().
When called by DEBUG from a TALLOC_FREE, this produced messages
"no talloc stackframe around, leaking memory". For example when
used from net conf.
This also adds a temporary talloc context to alloc_sub_basic().
For this purpose, the exit strategy is slightly altered: a common
exit point is used for success and failure.
Michael
(This used to be commit 16b5800d4e3a8b88bac67b2550d14e0aaaa302a9)
Diffstat (limited to 'source3/web')
-rw-r--r-- | source3/web/swat.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c index bb418db04b..6d8f4cae06 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -438,11 +438,15 @@ static bool load_config(bool save_def) ****************************************************************************/ static void write_config(FILE *f, bool show_defaults) { + TALLOC_CTX *ctx = talloc_stackframe(); + fprintf(f, "# Samba config file created using SWAT\n"); fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr()); - fprintf(f, "# Date: %s\n\n", current_timestring(False)); + fprintf(f, "# Date: %s\n\n", current_timestring(ctx, False)); lp_dump(f, show_defaults, iNumNonAutoPrintServices); + + TALLOC_FREE(ctx); } /**************************************************************************** |