diff options
-rw-r--r-- | source3/lib/util_str.c | 18 | ||||
-rw-r--r-- | source3/libads/ldap.c | 4 | ||||
-rw-r--r-- | source3/libgpo/gpo_ldap.c | 13 | ||||
-rw-r--r-- | source3/param/loadparm.c | 25 | ||||
-rw-r--r-- | source3/smbd/password.c | 6 |
5 files changed, 21 insertions, 45 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index fb3392f041..93ecad728d 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1841,8 +1841,7 @@ int fstr_sprintf(fstring s, const char *fmt, ...) #define S_LIST_ABS 16 /* List Allocation Block Size */ -static char **str_list_make_internal(TALLOC_CTX *mem_ctx, const char *string, - const char *sep) +char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep) { char **list; const char *str; @@ -1902,11 +1901,6 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx, const char *string, return list; } -char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep) -{ - return str_list_make_internal(mem_ctx, string, sep); -} - bool str_list_copy(TALLOC_CTX *mem_ctx, char ***dest, const char **src) { char **list; @@ -1960,16 +1954,6 @@ bool str_list_compare(char **list1, char **list2) return true; } -void str_list_free_talloc(TALLOC_CTX *mem_ctx, char ***list) -{ - TALLOC_FREE(*list); -} - -void str_list_free(char ***list) -{ - TALLOC_FREE(*list); -} - /****************************************************************************** *****************************************************************************/ diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index ef6feb8ee0..d6b9ba622b 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -801,7 +801,7 @@ done: } /* if/when we decide to utf8-encode attrs, take out this next line */ - str_list_free(&search_attrs); + TALLOC_FREE(search_attrs); return ADS_ERROR(rc); } @@ -998,7 +998,7 @@ ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path, done: talloc_destroy(ctx); /* if/when we decide to utf8-encode attrs, take out this next line */ - str_list_free(&search_attrs); + TALLOC_FREE(search_attrs); return ADS_ERROR(rc); } /** diff --git a/source3/libgpo/gpo_ldap.c b/source3/libgpo/gpo_ldap.c index 1d6b275663..a34e6861a5 100644 --- a/source3/libgpo/gpo_ldap.c +++ b/source3/libgpo/gpo_ldap.c @@ -137,12 +137,8 @@ bool ads_parse_gp_ext(TALLOC_CTX *mem_ctx, ret = True; parse_error: - if (ext_list) { - str_list_free_talloc(mem_ctx, &ext_list); - } - if (ext_strings) { - str_list_free_talloc(mem_ctx, &ext_strings); - } + TALLOC_FREE(ext_list); + TALLOC_FREE(ext_strings); return ret; } @@ -226,10 +222,7 @@ static ADS_STATUS gpo_parse_gplink(TALLOC_CTX *mem_ctx, status = ADS_SUCCESS; parse_error: - - if (link_list) { - str_list_free_talloc(mem_ctx, &link_list); - } + TALLOC_FREE(link_list); return status; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 5ecb3a4e70..8edd32e937 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2494,9 +2494,10 @@ static void free_service(service *pservice) PTR_DIFF(parm_table[i].ptr, &sDefault))); else if (parm_table[i].type == P_LIST && parm_table[i].p_class == P_LOCAL) - str_list_free((char ***) - (((char *)pservice) + - PTR_DIFF(parm_table[i].ptr, &sDefault))); + TALLOC_FREE(*((char ***) + (((char *)pservice) + + PTR_DIFF(parm_table[i].ptr, + &sDefault)))); } data = pservice->param_opt; @@ -2506,7 +2507,7 @@ static void free_service(service *pservice) DEBUG(5,("[%s = %s]\n", data->key, data->value)); string_free(&data->key); string_free(&data->value); - str_list_free(&data->list); + TALLOC_FREE(data->list); pdata = data->next; SAFE_FREE(data); data = pdata; @@ -2566,7 +2567,7 @@ static int add_a_service(const service *pservice, const char *name) while (data) { string_free(&data->key); string_free(&data->value); - str_list_free(&data->list); + TALLOC_FREE(data->list); pdata = data->next; SAFE_FREE(data); data = pdata; @@ -3275,7 +3276,7 @@ static void copy_service(service * pserviceDest, service * pserviceSource, strupper_m(*(char **)dest_ptr); break; case P_LIST: - str_list_free((char ***)dest_ptr); + TALLOC_FREE(*((char ***)dest_ptr)); str_list_copy(NULL, (char ***)dest_ptr, *(const char ***)src_ptr); break; @@ -3300,7 +3301,7 @@ static void copy_service(service * pserviceDest, service * pserviceSource, /* If we already have same option, override it */ if (strcmp(pdata->key, data->key) == 0) { string_free(&pdata->value); - str_list_free(&data->list); + TALLOC_FREE(data->list); pdata->value = SMB_STRDUP(data->value); not_added = False; break; @@ -3775,7 +3776,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) { - str_list_free(&Globals.szNetbiosAliases); + TALLOC_FREE(Globals.szNetbiosAliases); Globals.szNetbiosAliases = str_list_make(NULL, pszParmValue, NULL); return set_netbios_aliases((const char **)Globals.szNetbiosAliases); } @@ -4100,7 +4101,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue /* If we already have same option, override it */ if (strcmp(data->key, param_key) == 0) { string_free(&data->value); - str_list_free(&data->list); + TALLOC_FREE(data->list); data->value = SMB_STRDUP(pszParmValue); not_added = False; break; @@ -4193,7 +4194,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue break; case P_LIST: - str_list_free((char ***)parm_ptr); + TALLOC_FREE(*((char ***)parm_ptr)); *(char ***)parm_ptr = str_list_make( NULL, pszParmValue, NULL); break; @@ -5650,7 +5651,7 @@ void gfree_loadparm(void) string_free( (char**)parm_table[i].ptr ); } else if (parm_table[i].type == P_LIST) { - str_list_free( (char***)parm_table[i].ptr ); + TALLOC_FREE( *((char***)parm_table[i].ptr) ); } } } @@ -5690,7 +5691,7 @@ bool lp_load(const char *pszFname, while (data) { string_free(&data->key); string_free(&data->value); - str_list_free(&data->list); + TALLOC_FREE(data->list); pdata = data->next; SAFE_FREE(data); data = pdata; diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 913c3c35da..687b67950a 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -595,8 +595,7 @@ static bool user_ok(const char *user, int snum) } } } - if (invalid) - str_list_free (&invalid); + TALLOC_FREE(invalid); if (ret && lp_valid_users(snum)) { str_list_copy(talloc_tos(), &valid, lp_valid_users(snum)); @@ -611,8 +610,7 @@ static bool user_ok(const char *user, int snum) } } } - if (valid) - str_list_free (&valid); + TALLOC_FREE(valid); if (ret && lp_onlyuser(snum)) { char **user_list = str_list_make( |