fixed segfault in free (reading header type after munmap of the zone)

This commit is contained in:
thrieg 2025-12-13 06:54:57 +01:00
parent 0384df02e9
commit 6bc3783b67

View file

@ -6,7 +6,7 @@
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/19 15:44:05 by thrieg #+# #+# */
/* Updated: 2025/12/08 15:57:17 by thrieg ### ########.fr */
/* Updated: 2025/12/13 06:52:01 by thrieg ### ########.fr */
/* */
/* ************************************************************************** */
@ -92,12 +92,14 @@ void free(void *ptr)
else if (header->zone->type == E_SMALL)
{
header->occupied = false;
defrag_zone(header->zone);
if (defrag_zone(header->zone))
return; //zone munmaped, avoid all other logic on this memory
}
else if (header->zone->type == E_TINY)
{
header->occupied = false;
defrag_zone(header->zone);
if (defrag_zone(header->zone))
return; //zone munmaped, avoid all other logic on this memory
}
else
{