Skip to content

Commit 060c71d

Browse files
committed
clean up on error
1 parent 06c703f commit 060c71d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/lib/util/dict_tokenize.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,7 +2336,7 @@ static int dict_read_process_enum(dict_tokenize_ctx_t *dctx, char **argv, int ar
23362336
default:
23372337
fr_strerror_printf("ENUMs can only be a leaf type, not %s",
23382338
fr_type_to_str(da->type));
2339-
break;
2339+
goto error;
23402340
}
23412341

23422342
parent = CURRENT_FRAME(dctx)->da;
@@ -3835,15 +3835,17 @@ int fr_dict_parse_str(fr_dict_t *dict, char const *input, fr_dict_attr_t const *
38353835
dctx.stack[0].da = parent;
38363836
dctx.stack[0].nest = NEST_TOP;
38373837

3838-
if (dict_fixup_init(NULL, &dctx.fixup) < 0) return -1;
3838+
if (dict_fixup_init(NULL, &dctx.fixup) < 0) {
3839+
error:
3840+
TALLOC_FREE(dctx.fixup.pool);
3841+
talloc_free(buf);
3842+
return -1;
3843+
}
38393844

38403845
if (strcasecmp(argv[0], "VALUE") == 0) {
38413846
if (argc < 4) {
38423847
fr_strerror_printf("VALUE needs at least 4 arguments, got %i", argc);
3843-
error:
3844-
TALLOC_FREE(dctx.fixup.pool);
3845-
talloc_free(buf);
3846-
return -1;
3848+
goto error;
38473849
}
38483850

38493851
if (!fr_dict_attr_by_oid(NULL, fr_dict_root(dict), argv[1])) {

0 commit comments

Comments
 (0)