diff --git a/cli/main.c b/cli/main.c index 9e5a661..45b221e 100644 --- a/cli/main.c +++ b/cli/main.c @@ -1471,6 +1471,7 @@ cleanup3: printf("\n"); out: + pkgconf_solution_free(&pkg_client, &world); pkgconf_queue_free(&pkgq); pkgconf_cross_personality_deinit(personality); pkgconf_client_deinit(&pkg_client); diff --git a/libpkgconf/libpkgconf.h b/libpkgconf/libpkgconf.h index a9e7d96..7489719 100644 --- a/libpkgconf/libpkgconf.h +++ b/libpkgconf/libpkgconf.h @@ -384,6 +384,7 @@ PKGCONF_API bool pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *l PKGCONF_API void pkgconf_queue_free(pkgconf_list_t *list); PKGCONF_API bool pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data); PKGCONF_API bool pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxdepth); +PKGCONF_API void pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world); /* cache.c */ PKGCONF_API pkgconf_pkg_t *pkgconf_cache_lookup(pkgconf_client_t *client, const char *id); diff --git a/libpkgconf/queue.c b/libpkgconf/queue.c index 91e9a30..61637e3 100644 --- a/libpkgconf/queue.c +++ b/libpkgconf/queue.c @@ -255,6 +255,29 @@ pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_lis return PKGCONF_PKG_ERRF_OK; } +/* + * !doc + * + * .. c:function:: void pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world, int maxdepth) + * + * Removes references to package nodes contained in a solution. + * + * :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. + * :param pkgconf_pkg_t* world: The root for the generated dependency graph. Should have PKGCONF_PKG_PROPF_VIRTUAL flag. + * :returns: nothing + */ +void +pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world) +{ + (void) client; + + if (world->flags & PKGCONF_PKG_PROPF_VIRTUAL) + { + pkgconf_dependency_free(&world->required); + pkgconf_dependency_free(&world->requires_private); + } +} + /* * !doc * @@ -264,7 +287,7 @@ pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_lis * * :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution. * :param pkgconf_list_t* list: The list of dependency requests to consider. - * :param pkgconf_pkg_t* world: The root for the generated dependency graph, provided by the caller. Should have PKGCONF_PKG_PKGF_VIRTUAL flag. + * :param pkgconf_pkg_t* world: The root for the generated dependency graph, provided by the caller. Should have PKGCONF_PKG_PROPF_VIRTUAL flag. * :param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited. * :returns: true if the dependency resolver found a solution, otherwise false. * :rtype: bool