mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-03-15 03:16:51 +01:00
「🔨」 fix(exec/get_path): fixed leaks, hate myself
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/06/01 14:55:06 by mmoussou #+# #+# */
|
/* Created: 2024/06/01 14:55:06 by mmoussou #+# #+# */
|
||||||
/* Updated: 2024/07/21 17:57:47 by mmoussou ### ########.fr */
|
/* Updated: 2024/07/24 22:27:56 by mmoussou ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -67,9 +67,8 @@ int exec_single_cmd(t_cmd *cmd, char **env, t_env *env_t, int pipe_fd[2])
|
|||||||
{
|
{
|
||||||
if (exec.status == -1)
|
if (exec.status == -1)
|
||||||
printf("minishell : command not found: %s\n", input);
|
printf("minishell : command not found: %s\n", input);
|
||||||
get_exit_code(127);
|
|
||||||
free(input);
|
free(input);
|
||||||
return (-1);
|
return (get_exit_code(127));
|
||||||
}
|
}
|
||||||
free(input);
|
free(input);
|
||||||
exec.status = exec_single_cmd_execution(cmd, env, env_t, exec);
|
exec.status = exec_single_cmd_execution(cmd, env, env_t, exec);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/05/19 01:42:17 by mmoussou #+# #+# */
|
/* Created: 2024/05/19 01:42:17 by mmoussou #+# #+# */
|
||||||
/* Updated: 2024/06/13 14:19:20 by mmoussou ### ########.fr */
|
/* Updated: 2024/07/24 22:30:26 by mmoussou ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -33,9 +33,13 @@ char *get_path(char *path, char *cmd)
|
|||||||
char **path_dir;
|
char **path_dir;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!path)
|
||||||
|
free(cmd);
|
||||||
if (!path)
|
if (!path)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
path_dir = ft_split(path, ':');
|
path_dir = ft_split(path, ':');
|
||||||
|
if (!path_dir)
|
||||||
|
free(cmd);
|
||||||
if (!path_dir)
|
if (!path_dir)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
i = 0;
|
i = 0;
|
||||||
|
Reference in New Issue
Block a user