libpkgconf: path: add cleanup functions

feature/tap-sh
William Pitcock 2016-12-02 00:04:43 -06:00
parent b7984a795c
commit e7f4846508
3 changed files with 16 additions and 0 deletions

View File

@ -33,6 +33,7 @@ void
pkgconf_client_deinit(pkgconf_client_t *client)
{
pkgconf_tuple_free_global(client);
pkgconf_path_free(&client->dir_list);
}
void

View File

@ -260,5 +260,6 @@ void pkgconf_path_add(const char *text, pkgconf_list_t *dirlist);
size_t pkgconf_path_split(const char *text, pkgconf_list_t *dirlist);
size_t pkgconf_path_build_from_environ(const char *environ, const char *fallback, pkgconf_list_t *dirlist);
bool pkgconf_path_match_list(const char *path, pkgconf_list_t *dirlist);
void pkgconf_path_free(pkgconf_list_t *dirlist);
#endif

View File

@ -78,3 +78,17 @@ pkgconf_path_match_list(const char *path, pkgconf_list_t *dirlist)
return false;
}
void
pkgconf_path_free(pkgconf_list_t *dirlist)
{
pkgconf_node_t *n, *tn;
PKGCONF_FOREACH_LIST_ENTRY_SAFE(dirlist->head, tn, n)
{
pkgconf_path_t *pnode = n->data;
free(pnode->path);
free(pnode);
}
}