From b5e40ef6ba305d7a465062dd49939b96529436c3 Mon Sep 17 00:00:00 2001 From: "graham.gower" Date: Thu, 3 Dec 2009 03:03:48 +0000 Subject: [PATCH] Free memory when there are unresolved dependencies. git-svn-id: http://opkg.googlecode.com/svn/trunk@437 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- libopkg/opkg_install.c | 5 ++++- libopkg/pkg_depends.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index 44aad00..a01a378 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -48,7 +48,7 @@ satisfy_dependencies_for(opkg_conf_t *conf, pkg_t *pkg) int i, err; pkg_vec_t *depends = pkg_vec_alloc(); pkg_t *dep; - char **unresolved = NULL; + char **tmp, **unresolved = NULL; int ndepends; ndepends = pkg_hash_fetch_unsatisfied_dependencies(conf, @@ -59,10 +59,13 @@ satisfy_dependencies_for(opkg_conf_t *conf, pkg_t *pkg) opkg_message(conf, OPKG_ERROR, "%s: Cannot satisfy the following dependencies for %s:\n\t", conf->force_depends ? "Warning" : "ERROR", pkg->name); + tmp = unresolved; while (*unresolved) { opkg_message(conf, OPKG_ERROR, " %s", *unresolved); + free(*unresolved); unresolved++; } + free(tmp); opkg_message(conf, OPKG_ERROR, "\n"); if (! conf->force_depends) { opkg_message(conf, OPKG_INFO, diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c index 6355fe3..9fe9a71 100644 --- a/libopkg/pkg_depends.c +++ b/libopkg/pkg_depends.c @@ -236,6 +236,8 @@ int pkg_hash_fetch_unsatisfied_dependencies(opkg_conf_t *conf, pkg_t * pkg, unsatisfied, &newstuff); the_lost = merge_unresolved(the_lost, newstuff); + if (newstuff) + free(newstuff); } } } -- 2.25.1