libopkg: immediately free packages not marked for detail parsing
authorJo-Philipp Wich <jo@mein.io>
Thu, 16 Feb 2017 15:33:57 +0000 (16:33 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 16 Feb 2017 16:02:30 +0000 (17:02 +0100)
Stop recording packages into the dependency graph which are not flagged
with SF_NEED_DETAILS.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/pkg_hash.c

index 3b49301..4de4bdf 100644 (file)
@@ -142,6 +142,13 @@ pkg_hash_add_from_file(const char *file_name,
                        continue;
                }
 
+               if (!(pkg->state_flag & SF_NEED_DETAIL)) {
+                       //opkg_msg(DEBUG, "Package %s is unrelated, ignoring.\n", pkg->name);
+                       pkg_deinit(pkg);
+                       free(pkg);
+                       continue;
+               }
+
                if (!pkg_get_architecture(pkg) || !pkg_get_arch_priority(pkg)) {
                        char *version_str = pkg_version_str_alloc(pkg);
                        opkg_msg(NOTICE, "Package %s version %s has no "