From ca0990ed6c57fae428132d1244579989a6e18f34 Mon Sep 17 00:00:00 2001 From: dayano74 Date: Thu, 15 May 2025 15:58:53 +0900 Subject: [PATCH] fix memory leak of envp --- src/invoke_cmd/execute_cmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/invoke_cmd/execute_cmd.c b/src/invoke_cmd/execute_cmd.c index 9c2fa42..8e49222 100644 --- a/src/invoke_cmd/execute_cmd.c +++ b/src/invoke_cmd/execute_cmd.c @@ -6,7 +6,7 @@ /* By: dayano +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/21 21:25:41 by dayano #+# #+# */ -/* Updated: 2025/05/15 15:14:43 by dayano ### ########.fr */ +/* Updated: 2025/05/15 15:57:17 by dayano ### ########.fr */ /* */ /* ************************************************************************** */ @@ -63,9 +63,10 @@ void execute_cmd(t_cmd *cmd, t_minish *minish) return (print_cmd_not_found(cmd)); fullpath = get_cmd_path(cmd->argv[0], envp); if (access(fullpath, F_OK) < 0) - return (print_cmd_not_found(cmd)); + return (free_strs(&envp), print_cmd_not_found(cmd)); if (access(fullpath, X_OK) < 0) { + free_strs(&envp); print_error(cmd->argv[0]); cmd->status = CMD_FAILED_EXIT_STATUS; return ;