From 450dbb986b10606a4052a934fb6ad9006eba6a4b Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 4 Aug 2020 16:18:24 +0200 Subject: Freed leak --- Makefile | 8 ++++++++ libft/Makefile | 8 ++++++++ src/b_export.c | 1 + src/s_init.c | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d74ecf3..b91709a 100644 --- a/Makefile +++ b/Makefile @@ -119,6 +119,14 @@ asan: CFLAGS += -fsanitize=address asan: LFTRULE = asan asan: all #------------------------------------------------------------------------------# +msan: CFLAGS += -glldb +msan: CFLAGS += -fsanitize=memory +msan: CFLAGS += -fsanitize-memory-track-origins +msan: CFLAGS += -fno-common +msan: CFLAGS += -fno-omit-frame-pointer +msan: LFTRULE = msan +msan: all +#------------------------------------------------------------------------------# clean: @$(MAKE) --no-print-directory -C ${LFT_DIR} clean ${RM} ${OBJS_DIR} vgcore* diff --git a/libft/Makefile b/libft/Makefile index 7b1c22c..81cc2fd 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -162,6 +162,14 @@ asan: CFLAGS += -glldb asan: CFLAGS += -fsanitize=address asan: all #------------------------------------------------------------------------------# +msan: CFLAGS += -glldb +msan: CFLAGS += -fsanitize=memory +msan: CFLAGS += -fsanitize-memory-track-origins +msan: CFLAGS += -fno-common +msan: CFLAGS += -fno-omit-frame-pointer +msan: LFTRULE = msan +msan: all +#------------------------------------------------------------------------------# clean: ${RM} ${OBJS_DIR} #------------------------------------------------------------------------------# diff --git a/src/b_export.c b/src/b_export.c index fa9a6d1..4e3b4c7 100644 --- a/src/b_export.c +++ b/src/b_export.c @@ -118,6 +118,7 @@ uint8_t { ft_sprintf(fmt, "%s=%s", *ptr, varval); b_add_to_env_from_globals(*ptr, fmt, msh); + ft_memdel((void*)&varval); } } else if (next == FALSE && check_equals(*ptr) == TRUE) diff --git a/src/s_init.c b/src/s_init.c index d277984..cd03e72 100644 --- a/src/s_init.c +++ b/src/s_init.c @@ -75,7 +75,7 @@ static void t_msh *init_msh(char *const argv[], - char *const envp[]) + char *const envp[]) { t_msh *msh; -- cgit v1.2.3