fixed deadlock in ft_free
This commit is contained in:
parent
6bc3783b67
commit
4de08df981
1 changed files with 7 additions and 10 deletions
|
|
@ -3,10 +3,10 @@
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* ft_free.c :+: :+: :+: */
|
/* ft_free.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/11/19 15:44:05 by thrieg #+# #+# */
|
/* 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);
|
pthread_mutex_unlock(&g_mut);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (header->zone->type == E_SMALL)
|
else if (header->zone->type == E_SMALL || header->zone->type == E_TINY)
|
||||||
{
|
{
|
||||||
header->occupied = false;
|
header->occupied = false;
|
||||||
if (defrag_zone(header->zone))
|
if (defrag_zone(header->zone))
|
||||||
return; //zone munmaped, avoid all other logic on this memory
|
{
|
||||||
}
|
pthread_mutex_unlock(&g_mut);
|
||||||
else if (header->zone->type == E_TINY)
|
return; // zone munmaped, avoid all other logic on this memory
|
||||||
{
|
}
|
||||||
header->occupied = false;
|
|
||||||
if (defrag_zone(header->zone))
|
|
||||||
return; //zone munmaped, avoid all other logic on this memory
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue