libpkgconf: pkg: some elements of virtual packages should be freed as they have heap-allocated portions (closes #132)

feature/tap-sh
William Pitcock 2017-09-13 14:56:10 -05:00
parent 9b55fc3c23
commit f808300a01
1 changed files with 7 additions and 1 deletions

View File

@ -404,7 +404,10 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
void void
pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg) pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
{ {
if (pkg == NULL || pkg->flags & PKGCONF_PKG_PROPF_STATIC) if (pkg == NULL)
return;
if (pkg->flags & PKGCONF_PKG_PROPF_STATIC && !(pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL))
return; return;
pkgconf_cache_remove(client, pkg); pkgconf_cache_remove(client, pkg);
@ -421,6 +424,9 @@ pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
pkgconf_tuple_free(&pkg->vars); pkgconf_tuple_free(&pkg->vars);
if (pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL)
return;
if (pkg->id != NULL) if (pkg->id != NULL)
free(pkg->id); free(pkg->id);