Fix some memory leaks.

* src/named-ref.c: Add a pointer check (named_ref_free).
	* src/scan-code.l: New function (variant_table_free). Called in
	code_scanner_free.
	* src/symlist.c: Call to named_ref_free (symbol_list_free).
This commit is contained in:
Alex Rozenman
2009-07-24 21:04:16 +03:00
parent e459fb0e3c
commit 13cdf208ed
4 changed files with 29 additions and 2 deletions

View File

@@ -351,6 +351,15 @@ variant_table_grow ()
return &variant_table[variant_count - 1];
}
static void
variant_table_free ()
{
if (variant_table)
free (variant_table);
variant_table = 0;
variant_table_size = variant_count = 0;
}
static char *
find_prefix_end (const char *prefix, char *begin, char *end)
{
@@ -866,6 +875,8 @@ void
code_scanner_free (void)
{
obstack_free (&obstack_for_string, 0);
variant_table_free ();
/* Reclaim Flex's buffers. */
yylex_destroy ();
}