summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:26:29 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:26:29 (EST)
commite29c83204200606bcac195594e39c232b09eb9e0 (patch)
tree35d7f609e20ccb7df5f369befcbe93f6a0693d4f /libopkg
parent360c2d678173c15c335456a8065f998ad3dd7e62 (diff)
opkg: remove a serious memory leak
when searching every package opkg will clone the package but never released. git-svn-id: http://opkg.googlecode.com/svn/trunk@142 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/opkg.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index bb0470d..4560dc9 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -564,6 +564,7 @@ opkg_remove_package (opkg_t *opkg, const char *package_name, opkg_progress_callb
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_package (opkg_t *opkg, const char *package_name, opkg_progress_call
/* 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 @@ opkg_upgrade_package (opkg_t *opkg, const char *package_name, opkg_progress_call
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 @@ opkg_list_packages (opkg_t *opkg, opkg_package_callback_t callback, void *user_d
package = old_pkg_to_new (pkg);
callback (opkg, package, user_data);
+ opkg_package_free (package);
}
pkg_vec_free (all);
@@ -950,6 +956,7 @@ opkg_list_upgradable_packages (opkg_t *opkg, opkg_package_callback_t callback, v
{
package = old_pkg_to_new (new);
callback (opkg, package, user_data);
+ opkg_package_free (package);
}
}