[uim-commit] r421 - trunk/uim

kzk at freedesktop.org kzk at freedesktop.org
Mon Jan 31 04:48:51 PST 2005


Author: kzk
Date: 2005-01-31 04:48:49 -0800 (Mon, 31 Jan 2005)
New Revision: 421

Modified:
   trunk/uim/plugin.c
Log:
* uim/plugin.c
  - (plugin_load): abolish more memory leak.

* Until this commit, possible memory leak seems to be
  abolished. Thank you memprof!



Modified: trunk/uim/plugin.c
===================================================================
--- trunk/uim/plugin.c	2005-01-31 12:44:06 UTC (rev 420)
+++ trunk/uim/plugin.c	2005-01-31 12:48:49 UTC (rev 421)
@@ -100,6 +100,7 @@
 	     path, PLUGIN_PREFIX, plugin_name, PLUGIN_SUFFIX);
     fd = open(plugin_lib_filename, O_RDONLY);
     if(fd >= 0) {
+      free(path);
       close(fd);
       break;
     }
@@ -107,6 +108,11 @@
     free(plugin_lib_filename);
     plugin_lib_filename = NULL;
   }
+
+  if(plugin_lib_filename == NULL) {
+    free(plugin_name);
+    return uim_scm_f();
+  }
   
   for(path_car = uim_scm_car(scm_path), path_cdr = uim_scm_cdr(scm_path);
       path_car != uim_scm_f();
@@ -119,6 +125,7 @@
     snprintf(plugin_scm_filename, len, "%s/%s.scm", path, plugin_name);
     fd = open(plugin_scm_filename, O_RDONLY);
     if(fd >= 0) {
+      free(path);
       close(fd);
       break;
     }
@@ -126,11 +133,13 @@
     free(plugin_scm_filename);
     plugin_scm_filename = NULL;
   }
-  
-  if(plugin_lib_filename == NULL) {
+
+  if(plugin_scm_filename == NULL) {
+    free(plugin_lib_filename);
+    free(plugin_name);
     return uim_scm_f();
   }
-  
+    
   library = dlopen(plugin_lib_filename, RTLD_NOW);
   free(plugin_lib_filename);
 



More information about the Uim-commit mailing list