From 87f6a720c6ccb67fa8ce2946847e62c0e4e8aa08 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 6 Mar 2008 14:01:57 +0000 Subject: [PATCH] - fixes memory leak - ast2firm: descent_* must handle NULL top_type [r18914] --- ast2firm.c | 3 ++- parser.c | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ast2firm.c b/ast2firm.c index c8b4e72..8d1051d 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -3062,8 +3062,9 @@ static void descend_into_subtype(type_path_t *path) top->compound_entry = entry; top->index = 0; - path->top_type = entry->type; len = get_compound_size(&top_type->compound); + if(entry != NULL) + path->top_type = entry->type; } else { assert(is_type_array(top_type)); assert(top_type->array.size > 0); diff --git a/parser.c b/parser.c index a951117..856c580 100644 --- a/parser.c +++ b/parser.c @@ -1575,6 +1575,7 @@ error_parse_next: memcpy(&result->list.initializers, initializers, len * sizeof(initializers[0])); + DEL_ARR_F(initializers); ascend_to(path, top_path_level); return result; @@ -1657,9 +1658,6 @@ static initializer_t *parse_initializer(parse_initializer_env_t *env) return result; end_error: return NULL; - -end_error: - ; } static declaration_t *append_declaration(declaration_t *declaration); -- 2.20.1