The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ed1b3f13e72a53af1c68f0ae1cf359e4da7c6cf5

commit ed1b3f13e72a53af1c68f0ae1cf359e4da7c6cf5
Author:     Warner Losh <i...@freebsd.org>
AuthorDate: 2025-04-09 21:16:57 +0000
Commit:     Warner Losh <i...@freebsd.org>
CommitDate: 2025-04-09 21:16:57 +0000

    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 395c593bcabf..6979d5cfa5fd 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");

Reply via email to