mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-05 23:18:08 +01:00
fix(pwd): possible leak
This commit is contained in:
parent
4e7c9f4da9
commit
dd94aba23b
1 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/31 14:21:52 by kcolin #+# #+# */
|
/* Created: 2025/03/31 14:21:52 by kcolin #+# #+# */
|
||||||
/* Updated: 2025/04/29 15:42:51 by kcolin ### ########.fr */
|
/* Updated: 2025/05/05 15:28:40 by kcolin ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -27,9 +27,9 @@ static char *get_current_dir(void)
|
||||||
return (ft_errno(FT_EERRNO), NULL);
|
return (ft_errno(FT_EERRNO), NULL);
|
||||||
while (getcwd(path, size) == NULL)
|
while (getcwd(path, size) == NULL)
|
||||||
{
|
{
|
||||||
|
free(path);
|
||||||
if (errno != ERANGE)
|
if (errno != ERANGE)
|
||||||
return (ft_errno(FT_EERRNO), NULL);
|
return (ft_errno(FT_EERRNO), NULL);
|
||||||
free(path);
|
|
||||||
size *= 2;
|
size *= 2;
|
||||||
path = ft_calloc(size, sizeof(char));
|
path = ft_calloc(size, sizeof(char));
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue