Commit bc8ac16
committed
Panic if free_blocks_count is invalid in malloc()
In malloc(), free_blocks_count was decremented only if it was greater
than zero. However, once a usable block has been found,
free_blocks_count should never be zero. If this condition occurs, it
indicates a fatal inconsistency in allocator state.
Replace the conditional decrement with a check that panics with
ERR_HEAP_CORRUPT when free_blocks_count <= 0, ensuring the kernel halts
on heap accounting corruption.1 parent 64eb9cb commit bc8ac16
1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
| |||
0 commit comments