queue: when flattening sets, unref dependencies that will not be re-added

Dylan Baker 2022-07-27 13:39:44 -07:00
parent 798f2dac74
commit 21a645df00
1 changed files with 5 additions and 2 deletions

View File

@ -147,11 +147,11 @@ dep_sort_cmp(const void *a, const void *b)
static inline void
flatten_dependency_set(pkgconf_client_t *client, pkgconf_list_t *list)
{
pkgconf_node_t *node;
pkgconf_node_t *node, *next;
pkgconf_dependency_t **deps = NULL;
size_t dep_count = 0, i;
PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node)
{
pkgconf_dependency_t *dep = node->data;
pkgconf_pkg_t *pkg = pkgconf_pkg_verify_dependency(client, dep, NULL);
@ -161,6 +161,8 @@ flatten_dependency_set(pkgconf_client_t *client, pkgconf_list_t *list)
if (pkg->serial == client->serial)
{
PKGCONF_TRACE(client, "dedup %s serials match", pkg->id);
pkgconf_dependency_unref(dep->owner, dep);
goto next;
}
@ -180,6 +182,7 @@ flatten_dependency_set(pkgconf_client_t *client, pkgconf_list_t *list)
if (!strcmp(dep->package, other_dep->package))
{
PKGCONF_TRACE(client, "skipping, %zu deps", dep_count);
pkgconf_dependency_unref(dep->owner, dep);
goto next;
}
}