queue: don't collect static dependencies unless that's what we're looking for

Currently the required_private field gets walked twice, once when the
main required field is walked, and a second time when it is walked
itself. This results in the requires_private field leaking memory.
Dylan Baker 2022-07-28 10:57:30 -07:00
parent 7b3346206e
commit 36acd2e409
1 changed files with 14 additions and 10 deletions

View File

@ -116,22 +116,26 @@ pkgconf_queue_collect_dependents(pkgconf_client_t *client, pkgconf_pkg_t *pkg, v
if (pkg == world) if (pkg == world)
return; return;
PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node) if ((pkg->flags & PKGCONF_PKG_PROPF_STATIC) == PKGCONF_PKG_PROPF_STATIC) {
{ PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
pkgconf_dependency_t *flattened_dep; {
pkgconf_dependency_t *flattened_dep;
flattened_dep = pkgconf_dependency_copy(client, node->data); flattened_dep = pkgconf_dependency_copy(client, node->data);
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required); pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->requires_private);
}
} }
else
PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
{ {
pkgconf_dependency_t *flattened_dep; PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node)
{
pkgconf_dependency_t *flattened_dep;
flattened_dep = pkgconf_dependency_copy(client, node->data); flattened_dep = pkgconf_dependency_copy(client, node->data);
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->requires_private); pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required);
}
} }
} }