From ed1b3f13e72a53af1c68f0ae1cf359e4da7c6cf5 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 9 Apr 2025 15:16:57 -0600 Subject: [PATCH] kboot: Free prior segs in init_avail() We can call init_avail() multiple times. Each time, we want to toss whatever garbage may have already been there from a prior failed attempt to find a good memory map. Sponsored by: Netflix --- stand/kboot/libkboot/seg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/stand/kboot/libkboot/seg.c b/stand/kboot/libkboot/seg.c index 395c593bcab..6979d5cfa5f 100644 --- a/stand/kboot/libkboot/seg.c +++ b/stand/kboot/libkboot/seg.c @@ -20,6 +20,7 @@ init_avail(void) free(segs); nr_seg = 0; segalloc = 16; + free(segs); segs = malloc(sizeof(*segs) * segalloc); if (segs == NULL) panic("not enough memory to get memory map\n");