2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Add free_userspecs() and free_default() and use them instead of

looping over the lists and calling free_userspec() and free_default().
This commit is contained in:
Todd C. Miller
2018-05-15 16:35:07 -06:00
parent 3a4c0e06c1
commit f38317269d
6 changed files with 82 additions and 105 deletions

View File

@@ -71,9 +71,6 @@ sudo_file_open(struct sudo_nss *nss)
static int
sudo_file_close(struct sudo_nss *nss)
{
struct member_list *prev_binding = NULL;
struct defaults *def;
struct userspec *us;
debug_decl(sudo_file_close, SUDOERS_DEBUG_NSS)
if (nss->handle != NULL) {
@@ -82,14 +79,8 @@ sudo_file_close(struct sudo_nss *nss)
sudoersin = NULL;
/* XXX - do in main module? */
while ((us = TAILQ_FIRST(&nss->userspecs)) != NULL) {
TAILQ_REMOVE(&nss->userspecs, us, entries);
free_userspec(us);
}
while ((def = TAILQ_FIRST(&nss->defaults)) != NULL) {
TAILQ_REMOVE(&nss->defaults, def, entries);
free_default(def, &prev_binding);
}
free_userspecs(&nss->userspecs);
free_defaults(&nss->defaults);
}
debug_return_int(0);