From da6e2ddf0ea1449b725e0ab9c3a31444e1668613 Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Sat, 28 Feb 2009 06:12:06 +0000 Subject: [PATCH] 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 --- libopkg/opkg_install.c | 12 ++++++++++-- 1 file 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); -- 2.25.1