ports/89934: Update port: converters/recode. Fix memory leak.
Sergey Prikhodko
sergey at network-asp.biz
Sun Dec 4 14:00:09 UTC 2005
>Number: 89934
>Category: ports
>Synopsis: Update port: converters/recode. Fix memory leak.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sun Dec 04 14:00:08 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Sergey Prikhodko
>Release: FreeBSD 5.4-STABLE i386
>Organization:
Network-ASP
>Environment:
System: FreeBSD master.network-asp.biz 5.4-STABLE FreeBSD 5.4-STABLE #2: Fri Nov 4 15:03:13 EET 2005 root at master.network-asp.biz:/usr/obj/usr/src/sys/ROUTER i386
>Description:
librecode contains some memory leak on "outer" objects.
http://recode.progiciels-bpi.ca/showfile.html?name=courriel/m%C3%A9moire&index=5
New files added:
files/patch-src::names.c
files/patch-src::outer.c
>How-To-Repeat:
Try create/delete outer object in a loop.
>Fix:
--- patch-recode begins here ---
diff -ruN recode.orig/files/patch-src::names.c recode/files/patch-src::names.c
--- recode.orig/files/patch-src::names.c Thu Jan 1 03:00:00 1970
+++ recode/files/patch-src::names.c Fri Dec 2 16:13:10 2005
@@ -0,0 +1,33 @@
+--- src/names.c.orig Wed Dec 6 21:41:29 2000
++++ src/names.c Fri Dec 2 16:12:26 2005
+@@ -101,6 +101,21 @@
+ return strcmp (first->name, second->name) == 0;
+ }
+
++static void
++alias_freer (void *param)
++{
++ RECODE_ALIAS alias = param;
++ struct recode_surface_list *next = alias->implied_surfaces;
++ struct recode_surface_list *p;
++ while (next)
++ {
++ p = next->next;
++ free(next);
++ next = p;
++ }
++ free(alias);
++}
++
+ bool
+ prepare_for_aliases (RECODE_OUTER outer)
+ {
+@@ -108,7 +123,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_freer);
+ if (!outer->alias_table)
+ return false;
+
diff -ruN recode.orig/files/patch-src::outer.c recode/files/patch-src::outer.c
--- recode.orig/files/patch-src::outer.c Thu Jan 1 03:00:00 1970
+++ recode/files/patch-src::outer.c Fri Dec 2 16:14:07 2005
@@ -0,0 +1,18 @@
+--- src/outer.c.orig Wed Aug 30 23:16:14 2000
++++ src/outer.c Fri Dec 2 16:12:26 2005
+@@ -617,7 +617,14 @@
+ 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 ((void *) outer->one_to_same);
+ free (outer);
--- patch-recode ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list