summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-02-28 01:12:06 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-02-28 01:12:06 (EST)
commitda6e2ddf0ea1449b725e0ab9c3a31444e1668613 (patch)
tree0e42ba59c80de4afb03f9971d81d85082722db23
parent203ec8ddc7f466367c61bc9005c616685d3e74b5 (diff)
thanks to Koen, a memory leak were fond and fixed here.
When the flag is force-overwrite and replace files. opkg will not free the root_filename well. git-svn-id: http://opkg.googlecode.com/svn/trunk@202 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/opkg_install.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index a60b75f..f9bf732 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -1306,12 +1306,17 @@ static int check_data_file_clashes_change(opkg_conf_t *conf, pkg_t *pkg, pkg_t *
str_list_t *files_list;
str_list_elt_t *iter;
+ char *root_filename = NULL;
+
int clashes = 0;
files_list = pkg_get_installed_files(pkg);
for (iter = str_list_first(files_list); iter; iter = str_list_next(files_list, iter)) {
- char *root_filename;
char *filename = (char *) iter->data;
+ if (root_filename) {
+ free(root_filename);
+ root_filename = NULL;
+ }
root_filename = root_filename_alloc(conf, filename);
if (file_exists(root_filename) && (! file_is_dir(root_filename))) {
pkg_t *owner;
@@ -1336,7 +1341,10 @@ static int check_data_file_clashes_change(opkg_conf_t *conf, pkg_t *pkg, pkg_t *
}
}
- free(root_filename);
+ }
+ if (root_filename) {
+ free(root_filename);
+ root_filename = NULL;
}
pkg_free_installed_files(pkg);