]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fr_dict_finalise() should not free things it didn't allocate
authorAlan T. DeKok <aland@freeradius.org>
Wed, 14 Aug 2019 22:05:50 +0000 (18:05 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 14 Aug 2019 22:21:35 +0000 (18:21 -0400)
the caller will free the fixup_pool

src/lib/util/dict.c

index 7585b2c20acf09482dfe526a88e87011fbb7c3e0..36bec8f16d80081f240f2f356fc8ac3a55b1b182 100644 (file)
@@ -4829,7 +4829,6 @@ static int fr_dict_finalise(dict_from_file_ctx_t *ctx)
                        ctx->enum_fixup = next;
                }
        }
-       TALLOC_FREE(ctx->fixup_pool);
 
        /*
         *      Walk over all of the hash tables to ensure they're
@@ -5539,7 +5538,7 @@ static int dict_from_file(fr_dict_t *dict,
        rcode = _dict_from_file(&ctx,
                                dir_name, filename, src_file, src_line);
        if (rcode < 0) {
-               // free up the various fixups
+               TALLOC_FREE(ctx.fixup_pool);
                return rcode;
        }
 
@@ -5550,7 +5549,10 @@ static int dict_from_file(fr_dict_t *dict,
         *      Fixups should have been applied already to any protocol
         *      dictionaries.
         */
-       return fr_dict_finalise(&ctx);
+       rcode = fr_dict_finalise(&ctx);
+       if (rcode < 0) TALLOC_FREE(ctx.fixup_pool);
+
+       return rcode;
 }
 
 /** (Re-)Initialize the special internal dictionary
@@ -5992,6 +5994,7 @@ int fr_dict_parse_str(fr_dict_t *dict, char *buf, fr_dict_attr_t const *parent)
        }
 
        fr_dict_finalise(&ctx);
+       TALLOC_FREE(ctx.fixup_pool);
 
        return 0;
 }