:: commit 1209935a7b1b566cfcdcbc9245abe4cdc4618db7

Mintsuki <mintsuki@protonmail.com> — 2026-01-11 21:09

parents: 7d6f5b4adf

disk: Free volume struct on partition enumeration failure

diff --git a/common/drivers/disk.s2.c b/common/drivers/disk.s2.c
index 104bdd99..e27c67cb 100644
--- a/common/drivers/disk.s2.c
+++ b/common/drivers/disk.s2.c
@@ -348,10 +348,14 @@ void disk_create_index(void) {
             struct volume *p = ext_mem_alloc(sizeof(struct volume));
             int ret = part_get(p, block, part);
 
-            if (ret == END_OF_TABLE || ret == INVALID_TABLE)
+            if (ret == END_OF_TABLE || ret == INVALID_TABLE) {
+                pmm_free(p, sizeof(struct volume));
                 break;
-            if (ret == NO_PARTITION)
+            }
+            if (ret == NO_PARTITION) {
+                pmm_free(p, sizeof(struct volume));
                 continue;
+            }
 
             volume_index = pmm_realloc(
                 volume_index,
tab: 248 wrap: offon