Make sure to also zero out structures put on local free lists so allocations

satisfied from those lists get zeroed memory back too.
This commit is contained in:
rafal 2003-11-25 19:34:05 +00:00
parent e8e5a9a580
commit 8489e24b62
2 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.c,v 1.12 2003/11/24 21:44:37 christos Exp $ */
/* $NetBSD: hash.c,v 1.13 2003/11/25 19:34:05 rafal Exp $ */
/*
* Copyright (c) 1992, 1993
@ -251,6 +251,8 @@ ht_remove(struct hashtab *ht, const char *name)
if (hp->h_name != name)
continue;
TAILQ_REMOVE(hpp, hp, h_next);
memset(hp, 0, sizeof(*hp));
TAILQ_INSERT_TAIL(&hefreelist, hp, h_next);
ht->ht_used--;
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.19 2003/11/24 21:44:37 christos Exp $ */
/* $NetBSD: util.c,v 1.20 2003/11/25 19:34:06 rafal Exp $ */
/*
* Copyright (c) 1992, 1993
@ -223,6 +223,7 @@ void
nvfree(struct nvlist *nv)
{
memset(nv, 0, sizeof(*nv));
nv->nv_next = nvfreelist;
nvfreelist = nv;
}
@ -237,6 +238,7 @@ nvfreel(struct nvlist *nv)
for (; nv != NULL; nv = next) {
next = nv->nv_next;
memset(nv, 0, sizeof(*nv));
nv->nv_next = nvfreelist;
nvfreelist = nv;
}