fixed deadlock in ft_free

This commit is contained in:
Thomas Rieg 2025-12-15 15:56:19 +01:00
parent 6bc3783b67
commit 4de08df981

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* ft_free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/19 15:44:05 by thrieg #+# #+# */
/* Updated: 2025/12/13 06:52:01 by thrieg ### ########.fr */
/* Updated: 2025/12/15 15:54:45 by thrieg ### ########.fr */
/* */
/* ************************************************************************** */
@ -89,17 +89,14 @@ void free(void *ptr)
pthread_mutex_unlock(&g_mut);
return;
}
else if (header->zone->type == E_SMALL)
else if (header->zone->type == E_SMALL || header->zone->type == E_TINY)
{
header->occupied = false;
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;
if (defrag_zone(header->zone))
return; //zone munmaped, avoid all other logic on this memory
{
pthread_mutex_unlock(&g_mut);
return; // zone munmaped, avoid all other logic on this memory
}
}
else
{