[Anthy-dev 6] [PATCH] anthy-3507 memory leak

Back to archive index

YamaKen yamak****@bp*****
2002年 11月 9日 (土) 13:31:11 JST


ヤマケンです。

anthy-3507にいくつかメモリリークを見つけました。確認お願いします。


----------------------------------------------------------------
diff -ur anthy-3507.orig/include/conf.h anthy-3507/include/conf.h
--- anthy-3507.orig/include/conf.h	Thu Mar 14 22:14:32 2002
+++ anthy-3507/include/conf.h	Fri Nov  8 23:36:34 2002
@@ -4,6 +4,7 @@
 
 void anthy_do_conf_init(void);
 void anthy_do_conf_override(const char *, const char *);
+void anthy_conf_free(void);
 
 const char *anthy_conf_get_str(const char *var);
 
diff -ur anthy-3507.orig/src-diclib/conf.c anthy-3507/src-diclib/conf.c
--- anthy-3507.orig/src-diclib/conf.c	Mon May 13 21:39:51 2002
+++ anthy-3507/src-diclib/conf.c	Sat Nov  9 02:03:44 2002
@@ -149,6 +149,18 @@
   }
 }
 
+void
+anthy_conf_free(void)
+{
+  struct val_ent *e, *next;
+  for (e = ent_list; e; e = next) {
+    free((char *)e->var);
+    free((char *)e->val);
+    next = e->next;
+    free(e);
+  }
+}
+
 const char *
 anthy_conf_get_str(const char *var)
 {
diff -ur anthy-3507.orig/src-diclib/dic_main.c anthy-3507/src-diclib/dic_main.c
--- anthy-3507.orig/src-diclib/dic_main.c	Thu Jul 25 21:54:14 2002
+++ anthy-3507/src-diclib/dic_main.c	Fri Nov  8 23:42:57 2002
@@ -235,6 +235,7 @@
   anthy_current_dic = 0;
   anthy_quit_ddic();
   anthy_quit_allocator();
+  anthy_conf_free();
   dic_is_init = 0;
 }
 
diff -ur anthy-3507.orig/src-util/input.c anthy-3507/src-util/input.c
--- anthy-3507.orig/src-util/input.c	Thu Nov  7 23:41:12 2002
+++ anthy-3507/src-util/input.c	Sat Nov  9 01:34:54 2002
@@ -769,10 +769,13 @@
 {
   struct anthy_input_segment* p, * q;
 
+  free(pedit->commit);
+  free(pedit->cut_buf);
   for (p = pedit->segment; p; p = q) {
     q = p->next;
     anthy_input_free_segment(p);
   }
+  free(pedit);
 }
 
 void
diff -ur anthy-3507.orig/src-util/rkconv.c anthy-3507/src-util/rkconv.c
--- anthy-3507.orig/src-util/rkconv.c	Sun Jun  2 20:34:27 2002
+++ anthy-3507/src-util/rkconv.c	Sat Nov  9 00:29:36 2002
@@ -206,7 +206,9 @@
   int i;
   free(cl->prefix);
   for (i = 0; i < 128; i++) {
-    free(cl->next[i]);
+    if (cl->next[i]) {
+      rk_slr_closure_free(cl->next[i]);
+    }
   }
   free(cl);
 }
@@ -245,6 +247,7 @@
   }
   rk_rule_set_free(map->rs);
   rk_slr_closure_free(map->cl);
+  free(map);
   return 0;
 }
 
----------------------------------------------------------------


-------------------------------
ヤマケン yamak****@bp*****



Anthy-dev メーリングリストの案内
Back to archive index