]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't access list after it's been freed
authorAlan T. DeKok <aland@freeradius.org>
Tue, 27 Apr 2021 11:40:50 +0000 (07:40 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 27 Apr 2021 11:40:50 +0000 (07:40 -0400)
and don't free a list on parse error.  We rely instead on the
caller to free things.

If we do want to free the temporary lists while reading, we will
have to add a temporary context, OR walk down the temporary list
freeing each individual element.

The temporary lists are allocated on the stack, so we cannot
talloc_free() them.

src/lib/server/users_file.c

index 31f2560c8ddfea0ea71f9ffd235eaec5cc06ec6e..4d7dfe8a456ed5b3ffc43ebceed9a71b84a13d70 100644 (file)
@@ -90,7 +90,6 @@ static inline void line_error_marker_adj(char const *src_file, int src_line,
 void pairlist_free(PAIR_LIST_LIST *pl)
 {
        talloc_free(pl);
-       pairlist_list_init(pl);
 }
 
 static fr_table_num_sorted_t const check_cmp_op_table[] = {
@@ -318,7 +317,6 @@ int pairlist_read(TALLOC_CTX *ctx, fr_dict_t const *dict, char const *file, PAIR
                if (leading_spaces) {
                        ERROR_MARKER(&sbuff, "Entry does not begin with a user name");
                fail:
-                       pairlist_free(list);
                        fclose(fp);
                        return -1;
                }