r4562 - trunk/src/target/opkg/libopkg

tick at docs.openmoko.org tick at docs.openmoko.org
Tue Jul 29 16:07:06 CEST 2008


Author: tick
Date: 2008-07-29 16:07:05 +0200 (Tue, 29 Jul 2008)
New Revision: 4562

Modified:
   trunk/src/target/opkg/libopkg/opkg.c
Log:
opkg: remove a serious memory leak
      when searching every package opkg will clone the package but never released. 


Modified: trunk/src/target/opkg/libopkg/opkg.c
===================================================================
--- trunk/src/target/opkg/libopkg/opkg.c	2008-07-28 11:58:02 UTC (rev 4561)
+++ trunk/src/target/opkg/libopkg/opkg.c	2008-07-29 14:07:05 UTC (rev 4562)
@@ -564,6 +564,7 @@
   if (pkg->state_status == SS_NOT_INSTALLED)
   {
     /* XXX:  Error: Package seems to be not installed (STATUS = NOT_INSTALLED). */
+    opkg_package_free (pdata.package);
     return OPKG_PACKAGE_NOT_INSTALLED;
   }
   progress (pdata, 25);
@@ -639,6 +640,8 @@
   /* opkg_upgrade_pkg returns the error codes of opkg_install_pkg */
   if (err)
   {
+
+    opkg_package_free (pdata.package);
     switch (err)
     {
       case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
@@ -654,8 +657,10 @@
   progress (pdata, 75);
 
   err = opkg_configure_packages (opkg->conf, NULL);
-  if (err)
+  if (err) {
+    opkg_package_free (pdata.package);  
     return OPKG_UNKNOWN_ERROR;
+  }
 
   /* write out status files and file lists */
   opkg_conf_write_status_files (opkg->conf);
@@ -906,6 +911,7 @@
 
     package = old_pkg_to_new (pkg);
     callback (opkg, package, user_data);
+    opkg_package_free (package);
   }
 
   pkg_vec_free (all);
@@ -950,6 +956,7 @@
     {
       package = old_pkg_to_new (new);
       callback (opkg, package, user_data);
+      opkg_package_free (package);
     }
   }
 





More information about the commitlog mailing list