[uim-commit] r418 - trunk/uim

kzk at freedesktop.org kzk at freedesktop.org
Mon Jan 31 04:20:06 PST 2005


Author: kzk
Date: 2005-01-31 04:20:02 -0800 (Mon, 31 Jan 2005)
New Revision: 418

Modified:
   trunk/uim/plugin.c
   trunk/uim/uim-custom.c
Log:
* abolish 4 memory leaks

* uim/uim-custom.c
  - (extract_choice_list): free the old contents of choice_sym_list
  - (uim_custom_cb_update_cb_gate): free the string passed to
    update_cb

* uim/plugin.c
  - (plugin_load): free char *path, which is allocated by calling
    uim_scm_c_str


Modified: trunk/uim/plugin.c
===================================================================
--- trunk/uim/plugin.c	2005-01-31 11:42:52 UTC (rev 417)
+++ trunk/uim/plugin.c	2005-01-31 12:20:02 UTC (rev 418)
@@ -103,6 +103,7 @@
       close(fd);
       break;
     }
+    free(path);
     free(plugin_lib_filename);
     plugin_lib_filename = NULL;
   }
@@ -121,6 +122,7 @@
       close(fd);
       break;
     }
+    free(path);
     free(plugin_scm_filename);
     plugin_scm_filename = NULL;
   }

Modified: trunk/uim/uim-custom.c
===================================================================
--- trunk/uim/uim-custom.c	2005-01-31 11:42:52 UTC (rev 417)
+++ trunk/uim/uim-custom.c	2005-01-31 12:20:02 UTC (rev 418)
@@ -285,8 +285,10 @@
   for (p = choice_sym_list; *p; p++) {
     choice_sym = *p;
     custom_choice = uim_custom_choice_get(custom_sym, choice_sym);
+    free(choice_sym); /* free the old contents */
     *p = (char *)custom_choice;  /* intentionally overwrite */
   }
+
   /* reuse the list structure */
   custom_choice_list = (struct uim_custom_choice **)choice_sym_list;
 
@@ -1220,6 +1222,7 @@
   c_ptr = uim_scm_c_ptr(ptr);
   c_custom_sym = uim_scm_c_symbol(custom_sym);
   (*update_cb)(c_ptr, c_custom_sym);
+  free(c_custom_sym);
 
   return uim_scm_f();
 }



More information about the Uim-commit mailing list