diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-13 10:27:58 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-13 10:27:58 +0300 |
commit | 4c1056b45580fcb687cac656834f42dd9fba4ae8 (patch) | |
tree | d4bc6aaa3749fd0dbcb86f4d3e86d3b44d036b51 /src/grecs-lex.l | |
parent | 967d4d82ef9d10ecd6b32a29f2b3f2743175a268 (diff) | |
download | grecs-4c1056b45580fcb687cac656834f42dd9fba4ae8.tar.gz grecs-4c1056b45580fcb687cac656834f42dd9fba4ae8.tar.bz2 |
Fix memory leaks.
* src/grecs-gram.y (slist production): Free ep->data after appending.
* src/grecs-lex.l (string_list): Remove. All uses updated.
* src/tree.c (grecs_node_free): Free ident.
(grecs_tree_process): Fill config_keywords with zeros.
* src/grecs.h (grecs_getline): New proto.
* src/preproc.c (pp_getline): Rename to grecs_getline,
drop static qualifier. Improve initial allocation.
Diffstat (limited to 'src/grecs-lex.l')
-rw-r--r-- | src/grecs-lex.l | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/src/grecs-lex.l b/src/grecs-lex.l index faf6c4c..a3cc7d8 100644 --- a/src/grecs-lex.l +++ b/src/grecs-lex.l @@ -49,7 +49,6 @@ grecs_locus_t grecs_current_locus; /* Input file location */ static size_t xlines; static struct grecs_list *line_acc; -static struct grecs_list *string_list; static void multiline_begin(char *); static void multiline_add(char *); @@ -185,7 +184,6 @@ grecs_lex_begin(const char *name) line_acc = grecs_list_create(); line_acc->free_entry = line_acc_free_entry; - string_list = grecs_list_create(); if (grecs_preprocessor) { int fd; @@ -213,9 +211,6 @@ grecs_lex_begin(const char *name) void grecs_lex_end(int err) { - if (!err) - string_list->free_entry = NULL; - grecs_list_free(string_list); grecs_list_clear(line_acc); } @@ -392,7 +387,6 @@ grecs_line_finish() } str = grecs_malloc(size + 1); - grecs_list_append(string_list, str); for (ep = line_acc->head, p = str; ep; ep = ep->next) { struct line_acc_entry *ent = ep->data; char *str = line_acc_ptr(ent); @@ -417,7 +411,6 @@ ident() len = strlen(p); str = grecs_malloc(len + 1); strcpy(str, p); - grecs_list_append(string_list, str); yylval.string = str; return IDENT; } |