opkg: balance the installed_files reference count
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:26:01 +0000 (05:26 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:26:01 +0000 (05:26 +0000)
      reducing some memory leaks

git-svn-id: http://opkg.googlecode.com/svn/trunk@140 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/opkg_install.c
libopkg/pkg.c
libopkg/pkg_extract.c

index e1a50ccb8585c447d1819f4762c1961c82784358..a3893c7131f54e89cc2fc926d15d57f00af2e2cf 100644 (file)
@@ -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;
 }
 
index e15fc2430479c8b7088773d6ae436aa89062f7d4..26b6efe31b4da30d28c28bfaad067d069c7490d6 100644 (file)
@@ -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);
 
index 0649b9440241c3cc1eb0fbb25ce291ca6cfb680d..f97218234088a676b938ba44c30da730409d6315 100644 (file)
@@ -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);