Search
j0ke.net Open Build Service
>
Projects
>
home:jg
:
devel
>
recode
> recode-3.6-memleak.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File recode-3.6-memleak.patch of Package recode
2000-07-26 Andreas Schwab <schwab@suse.de> * names.c (alias_free): New function. (prepare_for_aliases): Pass it to hash_initialize. * outer.c (recode_delete_outer): Free elements of argmatch_charset_array and argmatch_surface_array. --- recode-3.5d/src/names.c.~2~ Wed Jul 26 19:02:19 2000 +++ recode-3.5d/src/names.c Wed Jul 26 19:02:28 2000 @@ -101,6 +101,20 @@ return strcmp (first->name, second->name) == 0; } +static void +alias_free (void *void_alias) +{ + RECODE_ALIAS alias = void_alias; + struct recode_surface_list *list, *next; + + for (list = alias->implied_surfaces; list != NULL; list = next) + { + next = list->next; + free (list); + } + free (alias); +} + bool prepare_for_aliases (RECODE_OUTER outer) { @@ -108,7 +122,7 @@ outer->number_of_symbols = 0; outer->alias_table - = hash_initialize (800, NULL, alias_hasher, alias_comparator, free); + = hash_initialize (800, NULL, alias_hasher, alias_comparator, alias_free); if (!outer->alias_table) return false; --- recode-3.5d/src/outer.c.~2~ Wed Jul 26 19:00:41 2000 +++ recode-3.5d/src/outer.c Wed Jul 26 19:00:59 2000 @@ -608,7 +608,15 @@ if (outer->alias_table) hash_free (outer->alias_table); if (outer->argmatch_charset_array) - free (outer->argmatch_charset_array); + { + char **cursor; + + for (cursor = outer->argmatch_charset_array; *cursor; cursor++) + free (*cursor); + for (cursor = outer->argmatch_surface_array; *cursor; cursor++) + free (*cursor); + free (outer->argmatch_charset_array); + } if (outer->one_to_same) free (outer->one_to_same); free (outer);