diff options
author | Jeremy Allison <jra@samba.org> | 2008-11-06 20:48:13 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-11-06 20:48:13 -0800 |
commit | 8962be69c700224983af4effd2cd086f7f5800b0 (patch) | |
tree | ad2149c31ca5102a213a13a75cd511b11c64d812 /source3/param | |
parent | 7ae625345536572aa946f0715542a5cf2dbc2169 (diff) | |
download | samba-8962be69c700224983af4effd2cd086f7f5800b0.tar.gz samba-8962be69c700224983af4effd2cd086f7f5800b0.tar.bz2 samba-8962be69c700224983af4effd2cd086f7f5800b0.zip |
Make us clean under valgrind --leak-check=full by using talloc_autofree_context() instead of NULL.
Remove the code in memcache that does a TALLOC_FREE on stored pointers. That's a disaster waiting
to happen. If you're storing talloc'ed pointers, you can't know their lifecycle and they should
be deleted when their parent context is deleted, so freeing them at some arbitrary point later
will be a double-free.
Jeremy.
Diffstat (limited to 'source3/param')
-rw-r--r-- | source3/param/loadparm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index fae6cb38dc..217957ab37 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4899,7 +4899,7 @@ static void init_globals(bool first_time_only) Globals.bWinbindTrustedDomainsOnly = False; Globals.bWinbindNestedGroups = True; Globals.winbind_expand_groups = 1; - Globals.szWinbindNssInfo = str_list_make_v3(NULL, "template", NULL); + Globals.szWinbindNssInfo = str_list_make_v3(talloc_autofree_context(), "template", NULL); Globals.bWinbindRefreshTickets = False; Globals.bWinbindOfflineLogon = False; @@ -5615,7 +5615,7 @@ const char **lp_parm_string_list(int snum, const char *type, const char *option, return (const char **)def; if (data->list==NULL) { - data->list = str_list_make_v3(NULL, data->value, NULL); + data->list = str_list_make_v3(talloc_autofree_context(), data->value, NULL); } return (const char **)data->list; @@ -6859,7 +6859,7 @@ static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr) static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr) { TALLOC_FREE(Globals.szNetbiosAliases); - Globals.szNetbiosAliases = str_list_make_v3(NULL, pszParmValue, NULL); + Globals.szNetbiosAliases = str_list_make_v3(talloc_autofree_context(), pszParmValue, NULL); return set_netbios_aliases((const char **)Globals.szNetbiosAliases); } @@ -7262,7 +7262,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue case P_LIST: TALLOC_FREE(*((char ***)parm_ptr)); *(char ***)parm_ptr = str_list_make_v3( - NULL, pszParmValue, NULL); + talloc_autofree_context(), pszParmValue, NULL); break; case P_STRING: |