From 45cba21d5001261fd5dbceeea1e7374bbee6c1b0 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 4 Jan 2016 16:54:22 +0100 Subject: [PATCH] fix leaks --- src/parser.h | 6 ++++++ src/parser_proc.y | 1 + 2 files changed, 7 insertions(+) diff --git a/src/parser.h b/src/parser.h index e774e9b..014509d 100644 --- a/src/parser.h +++ b/src/parser.h @@ -73,6 +73,9 @@ static inline decl_type *real_decl_type(decl_type *type) { } static inline void free_decl_type(decl_type *type) { + if (type->token) { + free(type->token); + } free(type->name); free(type); } @@ -539,6 +542,9 @@ static inline void free_impl_args(impl_args *args) { for (i = 0; i < args->count; ++i) { free_impl_arg(args->args[i]); } + if (args->vararg.name) { + free_impl_arg(args->vararg.name); + } free(args->args); free(args); } diff --git a/src/parser_proc.y b/src/parser_proc.y index fc2ff7a..d55f7e7 100644 --- a/src/parser_proc.y +++ b/src/parser_proc.y @@ -333,6 +333,7 @@ impl_args(args) ::= LPAREN impl_arg_list(args_) COMMA impl_vararg(va) RPAREN. { %destructor impl_vararg {free_impl_arg($$);} impl_vararg(va) ::= impl_type(type) reference(r) ELLIPSIS DOLLAR NAME(T). { va = init_impl_arg(type, init_impl_var(T->text, r), NULL); + free(T); } %type impl_arg_list {impl_args*} -- 2.30.2