From dd332b54d0586d48665af15127027be229bf06ef Mon Sep 17 00:00:00 2001 From: whaffman Date: Mon, 3 Mar 2025 12:01:33 +0100 Subject: [PATCH 1/3] dont need this anymorre? --- src/environment/environment_add.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/environment/environment_add.c b/src/environment/environment_add.c index 32049d0..96e7312 100644 --- a/src/environment/environment_add.c +++ b/src/environment/environment_add.c @@ -6,7 +6,7 @@ /* By: whaffman +#+ */ /* +#+ */ /* Created: 2025/02/04 16:13:33 by whaffman #+# #+# */ -/* Updated: 2025/02/26 16:09:07 by whaffman ######## odam.nl */ +/* Updated: 2025/03/03 12:00:19 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -22,18 +22,9 @@ void environment_add(t_minishell *msh, char *name, char *value) if (name != NULL && value != NULL) { new_environment = malloc_safe(msh, sizeof(t_environment)); - if (new_environment == NULL) - return (perror("malloc")); new_environment->name = ft_strdup_safe(msh, name); new_environment->value = ft_strdup_safe(msh, value); new_node = ft_lstnew_safe(msh, new_environment); - if (new_node == NULL - || new_environment->name == NULL - || new_environment->value == NULL) - { - environment_free(msh, new_environment); - return (perror("malloc")); - } ft_lstadd_back(environment, new_node); } } From b4bb4c900e8f5d6f04de5a32ef19db9db74f7caa Mon Sep 17 00:00:00 2001 From: whaffman Date: Mon, 3 Mar 2025 12:02:13 +0100 Subject: [PATCH 2/3] only frre is not null, and put flags in Makefile --- Makefile | 4 +++- src/utils/ft_free_arr_safe.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index afbb90d..f767677 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: qmennen +#+ # # +#+ # # Created: 2024/10/15 11:48:46 by whaffman #+# #+# # -# Updated: 2025/03/01 12:36:27 by whaffman ######## odam.nl # +# Updated: 2025/03/03 11:52:43 by whaffman ######## odam.nl # # # # **************************************************************************** # @@ -38,6 +38,8 @@ endif # Build configurations BUILD_CONFIGS = release debug asan tsan +FLAGS = -DNOCOLORS -DNOBANNER -DNOPROMPT + release_CFLAGS = -Wall -Werror -Werror -O2 debug_CFLAGS = -Wall -Werror -Werror -g3 -DDEBUG -DDBG='fprintf(stderr, RED "DEBUG: " RESET "%s:%d (%s)\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);' asan_CFLAGS = -Wall -Werror -Werror -fsanitize=address,leak,undefined -g3 diff --git a/src/utils/ft_free_arr_safe.c b/src/utils/ft_free_arr_safe.c index bd58f29..8b1ad4f 100644 --- a/src/utils/ft_free_arr_safe.c +++ b/src/utils/ft_free_arr_safe.c @@ -6,7 +6,7 @@ /* By: whaffman +#+ */ /* +#+ */ /* Created: 2025/03/01 14:20:45 by whaffman #+# #+# */ -/* Updated: 2025/03/02 22:09:58 by whaffman ######## odam.nl */ +/* Updated: 2025/03/03 11:55:00 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -22,5 +22,6 @@ void ft_free_arr_safe(t_minishell *msh, char **arr) free_safe(msh, (void **)&arr[i]); i++; } - free_safe(msh, (void **)&arr); + if (arr != NULL) + free_safe(msh, (void **)&arr); } From 8a5ffa0ca60cc3c1501ea83235c647489560b947 Mon Sep 17 00:00:00 2001 From: whaffman Date: Mon, 3 Mar 2025 21:05:09 +0100 Subject: [PATCH 3/3] libft --- lib/libft | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libft b/lib/libft index 0ebb29a..e1a01cb 160000 --- a/lib/libft +++ b/lib/libft @@ -1 +1 @@ -Subproject commit 0ebb29a9187cd7b77ac2372cdd1dee21d1e7873e +Subproject commit e1a01cbdfd8a18a0e1bd8dcc2c6fc3745b39cbce