- fixes memory leak
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 6 Mar 2008 14:01:57 +0000 (14:01 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 6 Mar 2008 14:01:57 +0000 (14:01 +0000)
- ast2firm: descent_* must handle NULL top_type

[r18914]

ast2firm.c
parser.c

index c8b4e72..8d1051d 100644 (file)
@@ -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);
index a951117..856c580 100644 (file)
--- 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);