From 20f8fa1b269c14670ce4f130fd7b1b30387067b4 Mon Sep 17 00:00:00 2001 From: gwojda Date: Mon, 27 Mar 2017 22:07:51 +0200 Subject: [PATCH] fix leaks del --- 42sh/libft/Makefile | 4 ++-- 42sh/src/line_editing/lib_line_editing/toolz_parseur.c | 2 +- 42sh/src/line_editing/print_del_completion/print_and_del.c | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/42sh/libft/Makefile b/42sh/libft/Makefile index 088122d9..344a1d97 100644 --- a/42sh/libft/Makefile +++ b/42sh/libft/Makefile @@ -6,7 +6,7 @@ # By: jhalford +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2017/02/07 16:09:36 by jhalford #+# #+# # -# Updated: 2017/03/23 16:49:31 by gwojda ### ########.fr # +# Updated: 2017/03/27 21:59:31 by gwojda ### ########.fr # # # # **************************************************************************** # @@ -19,7 +19,7 @@ RM = /bin/rm -rf W_FLAGS = -Wall -Wextra -Werror -g D_FLAGS = -g -V_FLAGS = -fvisibility=hidden +V_FLAGS = #-fvisibility=hidden FLAGS = $(W_FLAGS) $(D_FLAGS) $(V_FLAGS) DELTA = $$(echo "$$(tput cols)-47"|bc) diff --git a/42sh/src/line_editing/lib_line_editing/toolz_parseur.c b/42sh/src/line_editing/lib_line_editing/toolz_parseur.c index d74258ee..478db2dd 100644 --- a/42sh/src/line_editing/lib_line_editing/toolz_parseur.c +++ b/42sh/src/line_editing/lib_line_editing/toolz_parseur.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/16 16:14:46 by gwojda #+# #+# */ -/* Updated: 2017/03/21 10:03:23 by gwojda ### ########.fr */ +/* Updated: 2017/03/27 22:06:09 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/line_editing/print_del_completion/print_and_del.c b/42sh/src/line_editing/print_del_completion/print_and_del.c index b52abcd7..9dd948ca 100644 --- a/42sh/src/line_editing/print_del_completion/print_and_del.c +++ b/42sh/src/line_editing/print_del_completion/print_and_del.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/05 16:02:43 by gwojda #+# #+# */ -/* Updated: 2017/03/21 10:14:46 by gwojda ### ########.fr */ +/* Updated: 2017/03/27 22:07:39 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -52,7 +52,7 @@ static void ft_suppr_2(char **str, size_t *i, size_t tmp) ++(*i); ft_putnc('\b', *i - tmp); (*i) = tmp; - if (ft_strlen(*str) == 0) + if (!**str) ft_strdel(str); } @@ -105,5 +105,7 @@ int ft_del(char **str, size_t *pos) ++(*pos); ft_putnc('\b', *pos - tmp); *pos = tmp; + if (!**str) + ft_strdel(str); return (0); }