Free memory when there are unresolved dependencies.
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Thu, 3 Dec 2009 03:03:48 +0000 (03:03 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Thu, 3 Dec 2009 03:03:48 +0000 (03:03 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@437 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/opkg_install.c
libopkg/pkg_depends.c

index 44aad0097b6413413a53dafffeebef3c23b72a15..a01a3782d30126ba89994a187729cdf34d27009d 100644 (file)
@@ -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,
index 6355fe3fe4416a202a4d6ef978e481f817fd208d..9fe9a71b370fd96bcb586fc091eb18332f846028 100644 (file)
@@ -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);
                         }
                    }
               }