pkgconf_pkg_find() doesn't add package to cache #133
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
If pkgconf_pkg_find() creates a package via the pkgconf_pkg_new_from_file() it doesn't call pkgconf_cache_add() for it. The fact it will keep reloading the package again and again on the consecutive pkgconf_pkg_find() calls is only a half of the issue. The real problem is that pkgconf_pkg_free() being called for this package tries to remove it from the cache calling pkgconf_cache_remove(). This operation being called for a package that is not in the cache just breaks the cache (decrement it lenghts by 1 and resets tail/head to NULL), leaking all cached packages (see pkgconf_cache_remove() and pkgconf_node_delete() implementations).
in the case where pkgconf_pkg_new_from_file() is invoked, it's intentional to bypass the cache as it's a direct path instead of a dependency name.
i refactored the cache handling for the larger memory leak issue, thanks for spotting it.