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
This commit is contained in:
Warner Losh
2025-04-09 15:16:57 -06:00
parent 136d2dc093
commit ed1b3f13e7
+1
View File
@@ -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");