Don't try to destroy a tree we didn't create.

This commit is contained in:
Todd C. Miller
2005-02-01 04:03:29 +00:00
parent 3b8b88407f
commit 543fe6e7d6

View File

@@ -359,10 +359,14 @@ sudo_endpwent()
{ {
endpwent(); endpwent();
sudo_endspent(); sudo_endspent();
rbdestroy(pwcache_byuid, pw_free); if (pwcache_byuid != NULL) {
pwcache_byuid = NULL; rbdestroy(pwcache_byuid, pw_free);
rbdestroy(pwcache_byname, NULL); pwcache_byuid = NULL;
pwcache_byname = NULL; }
if (pwcache_byname != NULL) {
rbdestroy(pwcache_byname, NULL);
pwcache_byname = NULL;
}
} }
static void static void
@@ -551,8 +555,12 @@ void
sudo_endgrent() sudo_endgrent()
{ {
endgrent(); endgrent();
rbdestroy(grcache_bygid, free); if (grcache_bygid != NULL) {
grcache_bygid = NULL; rbdestroy(grcache_bygid, free);
rbdestroy(grcache_byname, NULL); grcache_bygid = NULL;
grcache_byname = NULL; }
if (grcache_byname != NULL) {
rbdestroy(grcache_byname, NULL);
grcache_byname = NULL;
}
} }