xicodomingues/francinette

The francinette does not do a free in the test of lst_map in libft.

Closed this issue · 2 comments

YD-S commented

The tester does not free up the 30 bytes of memory allocated in the function map_list in the fsoares test, i think that is causing a leak while in strict mode.

void *map_length(void *s)
{
char *str = malloc(30);
if (str != NULL)
sprintf(str, "__%lX", strlen((char *)s));
return str;
}

this function allocates 30 bytes but does not free it i think.

The problem is not with that function. Yes, it allocates memory, but the del function deletes that memory.
The problem is that in the function lstmap what happens when the allocation for lstnew fails?
If by this point you already called the f function, then you need to call del on that allocation.

That is what I think it is missing.

YD-S commented

I hope its that. :D