mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-03-15 11:26:51 +01:00
「🔨」 fix: fixed some leak
This commit is contained in:
@ -44,5 +44,6 @@ t_list **get_list(t_list **list);
|
|||||||
t_list **get_list2(t_list **list);
|
t_list **get_list2(t_list **list);
|
||||||
int get_exit_code(int in);
|
int get_exit_code(int in);
|
||||||
size_t ft_arrlen(char **a);
|
size_t ft_arrlen(char **a);
|
||||||
|
char **get_rl(char **rl);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/06/22 15:07:24 by adjoly #+# #+# */
|
/* Created: 2024/06/22 15:07:24 by adjoly #+# #+# */
|
||||||
/* Updated: 2024/07/12 15:26:48 by adjoly ### ########.fr */
|
/* Updated: 2024/07/15 16:38:59 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -31,6 +31,7 @@ void ft_cd(t_env *env, char *args)
|
|||||||
else
|
else
|
||||||
new_pwd = ft_strdup(args);
|
new_pwd = ft_strdup(args);
|
||||||
ret = chdir(new_pwd);
|
ret = chdir(new_pwd);
|
||||||
|
free(new_pwd);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
send_error_parsing(ERROR_NO_FILE);
|
send_error_parsing(ERROR_NO_FILE);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/10 01:14:10 by adjoly #+# #+# */
|
/* Created: 2024/07/10 01:14:10 by adjoly #+# #+# */
|
||||||
/* Updated: 2024/07/13 14:03:00 by adjoly ### ########.fr */
|
/* Updated: 2024/07/15 17:03:12 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -70,5 +70,6 @@ void __heredoc_sig(int code)
|
|||||||
ft_lstclear(get_list(NULL), &free_token);
|
ft_lstclear(get_list(NULL), &free_token);
|
||||||
close(get_fd_heredoc(-1));
|
close(get_fd_heredoc(-1));
|
||||||
rl_clear_history();
|
rl_clear_history();
|
||||||
|
free(*get_rl(NULL));
|
||||||
exit(130);
|
exit(130);
|
||||||
}
|
}
|
||||||
|
12
src/main.c
12
src/main.c
@ -6,13 +6,22 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/04/24 11:18:04 by adjoly #+# #+# */
|
/* Created: 2024/04/24 11:18:04 by adjoly #+# #+# */
|
||||||
/* Updated: 2024/07/15 14:02:18 by adjoly ### ########.fr */
|
/* Updated: 2024/07/15 17:03:47 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "minishell.h"
|
#include "minishell.h"
|
||||||
#include "parsing.h"
|
#include "parsing.h"
|
||||||
|
|
||||||
|
char **get_rl(char **rl)
|
||||||
|
{
|
||||||
|
static char **ret;
|
||||||
|
|
||||||
|
if (rl)
|
||||||
|
ret = rl;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
void sig_c(int code)
|
void sig_c(int code)
|
||||||
{
|
{
|
||||||
(void)code;
|
(void)code;
|
||||||
@ -71,6 +80,7 @@ int main(int ac, char **av, char **env)
|
|||||||
}
|
}
|
||||||
add_history(rl);
|
add_history(rl);
|
||||||
rl = env_var_replace(rl, env_l);
|
rl = env_var_replace(rl, env_l);
|
||||||
|
get_rl(&rl);
|
||||||
piped = tokenizer(rl);
|
piped = tokenizer(rl);
|
||||||
get_list(&piped);
|
get_list(&piped);
|
||||||
if (check_argv(piped))
|
if (check_argv(piped))
|
||||||
|
Reference in New Issue
Block a user