From 5b68464bd8b8405fae90c1d96cdd7367a506bd5c Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Mon, 15 Dec 2008 05:26:01 +0000 Subject: [PATCH] opkg: balance the installed_files reference count reducing some memory leaks git-svn-id: http://opkg.googlecode.com/svn/trunk@140 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- libopkg/opkg_install.c | 2 ++ libopkg/pkg.c | 1 + libopkg/pkg_extract.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index e1a50cc..a3893c7 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -506,7 +506,9 @@ static int update_file_ownership(opkg_conf_t *conf, pkg_t *new_pkg, pkg_t *old_p hash_table_insert(&conf->obs_file_hash, old_file, old_pkg); } } + pkg_free_installed_files(old_pkg); } + pkg_free_installed_files(new_pkg); return 0; } diff --git a/libopkg/pkg.c b/libopkg/pkg.c index e15fc24..26b6efe 100644 --- a/libopkg/pkg.c +++ b/libopkg/pkg.c @@ -1737,6 +1737,7 @@ int pkg_info_preinstall_check(opkg_conf_t *conf) // opkg_message(conf, OPKG_DEBUG2, "pkg %s: file=%s\n", pkg->name, installed_file); file_hash_set_file_owner(conf, installed_file, pkg); } + pkg_free_installed_files(pkg); } pkg_vec_free(installed_pkgs); diff --git a/libopkg/pkg_extract.c b/libopkg/pkg_extract.c index 0649b94..f972182 100644 --- a/libopkg/pkg_extract.c +++ b/libopkg/pkg_extract.c @@ -136,6 +136,8 @@ int pkg_extract_data_file_names_to_file(pkg_t *pkg, const char *file_name) } else { fputs(data_file, file); } + free(line); + line=NULL; } } fclose(tmp); -- 2.25.1