libpkgconf: zero path lists after freeing

This is required to make the pointer safely re-usable after being freed,
otherwise the list still says that it has nodes, but they point nowhere.
This is particularly important for libpkgconf, if a caller needs to
re-enter the library after freeing a path in a static path (such as the
default personality)
master
Dylan Baker 2022-04-01 14:15:43 -07:00 committed by Ariadne Conill
parent 2d201af326
commit c0fa7879b2
2 changed files with 4 additions and 0 deletions

View File

@ -268,6 +268,8 @@ pkgconf_path_free(pkgconf_list_t *dirlist)
free(pnode->path); free(pnode->path);
free(pnode); free(pnode);
} }
pkgconf_list_zero(dirlist);
} }
static char * static char *

View File

@ -390,4 +390,6 @@ pkgconf_tuple_free(pkgconf_list_t *list)
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node) PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node)
pkgconf_tuple_free_entry(node->data, list); pkgconf_tuple_free_entry(node->data, list);
pkgconf_list_zero(list);
} }