diff options
Diffstat (limited to 'libpkgconf/pkg.c')
-rw-r--r-- | libpkgconf/pkg.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index bcfb486..59957ff 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -16,6 +16,8 @@ #include <libpkgconf/config.h> #include <libpkgconf/libpkgconf.h> +#include <assert.h> + /* * !doc * @@ -407,6 +409,13 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE * void pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg) { + // The function leaks (issue #132 is reported). The whole concept of "static" + // packages is quite murky, so it's better just not to use it, at least + // until fixed by the library owners. In particular don't use + // pkgconf_queue_* functions. + // + assert (pkg == NULL || (pkg->flags & PKGCONF_PKG_PROPF_STATIC) == 0); + if (pkg == NULL || pkg->flags & PKGCONF_PKG_PROPF_STATIC) return; @@ -672,6 +681,10 @@ pkgconf_pkg_find(pkgconf_client_t *client, const char *name) if (pkg != NULL) { pkgconf_path_add(pkg_get_parent_dir(pkg), &client->dir_list, true); + + // Add the package to the cache (issue #133 is reported). + // + pkgconf_cache_add(client, pkg); return pkg; } } |