Plug minor memory leak when an error occurs while parsing enum entries.
authorChristoph Mallon <christoph.mallon@gmx.de>
Wed, 12 Dec 2007 09:19:07 +0000 (09:19 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Wed, 12 Dec 2007 09:19:07 +0000 (09:19 +0000)
[r18704]

parser.c

index 0e13218..2a075f5 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1378,13 +1378,13 @@ static void parse_enum_entries(type_t *const enum_type)
        }
 
        do {
-               declaration_t *entry = allocate_ast_zero(sizeof(entry[0]));
-
                if(token.type != T_IDENTIFIER) {
                        parse_error_expected("while parsing enum entry", T_IDENTIFIER, 0);
                        eat_block();
                        return;
                }
+
+               declaration_t *const entry = allocate_ast_zero(sizeof(entry[0]));
                entry->storage_class   = STORAGE_CLASS_ENUM_ENTRY;
                entry->type            = enum_type;
                entry->symbol          = token.v.symbol;