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 ac9b0e954b
commit 1e20ad112f
4 changed files with 29 additions and 2 deletions

View File

@@ -350,6 +350,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)
{
@@ -865,6 +874,8 @@ void
code_scanner_free (void)
{
obstack_free (&obstack_for_string, 0);
variant_table_free ();
/* Reclaim Flex's buffers. */
yylex_destroy ();
}