diff options
author | David Disseldorp <ddiss@samba.org> | 2018-06-25 02:28:41 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-07-06 20:37:20 +0200 |
commit | 887f9147b4ccb6498b0e93efd7ea3696d3d36df2 (patch) | |
tree | 0dc8d0a9a9784ee5a3afc48545516534932ee9f1 /source3/param | |
parent | c58194e3d296f4e14e7689bdf192c561635ae161 (diff) | |
download | samba-887f9147b4ccb6498b0e93efd7ea3696d3d36df2.tar.gz |
s3/loadparm: fix a few talloc stackframe leaks
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/param')
-rw-r--r-- | source3/param/loadparm.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 8f2f26a4d76..5f646d63ce0 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1530,6 +1530,7 @@ bool lp_add_home(const char *pszHomename, int iDefaultService, const char *user, const char *pszHomedir) { int i; + char *global_path; if (pszHomename == NULL || user == NULL || pszHomedir == NULL || pszHomedir[0] == '\0') { @@ -1541,12 +1542,13 @@ bool lp_add_home(const char *pszHomename, int iDefaultService, if (i < 0) return false; + global_path = lp_path(talloc_tos(), GLOBAL_SECTION_SNUM); if (!(*(ServicePtrs[iDefaultService]->path)) - || strequal(ServicePtrs[iDefaultService]->path, - lp_path(talloc_tos(), GLOBAL_SECTION_SNUM))) { + || strequal(ServicePtrs[iDefaultService]->path, global_path)) { lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->path, pszHomedir); } + TALLOC_FREE(global_path); if (!(*(ServicePtrs[i]->comment))) { char *comment = talloc_asprintf(talloc_tos(), "Home directory of %s", user); @@ -4156,6 +4158,7 @@ void lp_dump(FILE *f, bool show_defaults, int maxtoprint) fprintf(f,"\n"); lp_dump_one(f, show_defaults, iService); } + TALLOC_FREE(lp_ctx); } /*************************************************************************** @@ -4209,7 +4212,7 @@ int lp_servicenumber(const char *pszServiceName) if (!usershare_exists(iService, &last_mod)) { /* Remove the share security tdb entry for it. */ - delete_share_security(lp_servicename(talloc_tos(), iService)); + delete_share_security(lp_const_servicename(iService)); /* Remove it from the array. */ free_service_byindex(iService); /* Doesn't exist anymore. */ @@ -4526,10 +4529,10 @@ void widelinks_warning(int snum) } if (lp_unix_extensions() && lp_wide_links(snum)) { - DEBUG(0,("Share '%s' has wide links and unix extensions enabled. " + DBG_ERR("Share '%s' has wide links and unix extensions enabled. " "These parameters are incompatible. " "Wide links will be disabled for this share.\n", - lp_servicename(talloc_tos(), snum) )); + lp_const_servicename(snum)); } } |