proc/slab.c: Initialize struct slab_info in get_slabnode().

Especially its "next" member: this is what caused the crash in "slabtop:
Reset slab_list if get_slabinfo() fails." (if parse_slabinfo*() fails in
sscanf(), for example, then curr is set to NULL but it is already linked
into the "list" and its "next" member was never initialized).
This commit is contained in:
Qualys Security Advisory 1970-01-01 00:00:00 +00:00 committed by Craig Small
parent a33be33885
commit 7382ac88d5

View File

@ -48,6 +48,7 @@ static struct slab_info *free_index;
*/
static struct slab_info *get_slabnode(void)
{
static const struct slab_info initializer;
struct slab_info *node;
if (free_index) {
@ -56,7 +57,7 @@ static struct slab_info *get_slabnode(void)
} else {
node = xmalloc(sizeof(struct slab_info));
}
*node = initializer;
return node;
}