correction de leaks

This commit is contained in:
Gautier WOJDA 2017-02-02 11:13:02 +01:00
parent d5c830d347
commit b576eddd03
6 changed files with 10 additions and 13 deletions

View file

@ -13,7 +13,7 @@
NAME = 42sh NAME = 42sh
CC = gcc CC = gcc
FLAGS = -Wall -Wextra -Werror FLAGS = -Wall -Wextra -Werror -g
D_FLAGS = -g D_FLAGS = -g
DELTA = $$(echo "$$(tput cols)-47"|bc) DELTA = $$(echo "$$(tput cols)-47"|bc)

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/26 13:32:52 by gwojda #+# #+# */ /* Created: 2017/01/26 13:32:52 by gwojda #+# #+# */
/* Updated: 2017/01/26 13:50:00 by gwojda ### ########.fr */ /* Updated: 2017/02/02 11:11:11 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -17,7 +17,7 @@ void ft_check_backslash(char **str)
char *tmp1; char *tmp1;
char *tmp2; char *tmp2;
if (!*str) if (!*str || !**str)
return ; return ;
if ((*str)[ft_strlen(*str) - 1] == '\\') if ((*str)[ft_strlen(*str) - 1] == '\\')
{ {

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */ /* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */
/* Updated: 2017/02/01 16:50:57 by gwojda ### ########.fr */ /* Updated: 2017/02/02 10:38:58 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -112,11 +112,8 @@ char *ft_lecture(t_list_history *head)
else if (ft_lecture_3(ret, &str, &i)) else if (ft_lecture_3(ret, &str, &i))
continue ; continue ;
else if (ret == 10) else if (ret == 10)
break ; return (str);
else if (ft_isascii(ret) == 0) else if (ft_isascii(ret) == 0)
ft_read_it(ret, &i, &str); ft_read_it(ret, &i, &str);
} }
if (str)
ft_putstr(str + i);
return (str);
} }

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/05 16:02:43 by gwojda #+# #+# */ /* Created: 2017/01/05 16:02:43 by gwojda #+# #+# */
/* Updated: 2017/02/01 15:25:19 by gwojda ### ########.fr */ /* Updated: 2017/02/02 11:12:29 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -49,7 +49,7 @@ void ft_suppr_2(char **str, size_t *i, size_t tmp)
ft_putnc('\b', *i - tmp); ft_putnc('\b', *i - tmp);
(*i) = tmp; (*i) = tmp;
if (ft_strlen(*str) == 0) if (ft_strlen(*str) == 0)
*str = NULL; ft_strdel(str);
} }
void ft_suppr(char **str, size_t *i) void ft_suppr(char **str, size_t *i)

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */ /* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */
/* Updated: 2017/01/26 13:38:29 by gwojda ### ########.fr */ /* Updated: 2017/02/02 10:41:26 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -70,7 +70,7 @@ int ft_readline(void)
if (tcsetattr(0, TCSANOW, ft_stats_term_termcaps()) == -1) if (tcsetattr(0, TCSANOW, ft_stats_term_termcaps()) == -1)
return (-1); return (-1);
if (data_singleton()->line.input) if (data_singleton()->line.input)
data_singleton()->line.input = NULL; ft_strdel(&data_singleton()->line.input);
ft_prompt(); ft_prompt();
data_singleton()->line.input = ft_lecture(data_singleton()->line.list_beg); data_singleton()->line.input = ft_lecture(data_singleton()->line.list_beg);
ft_putchar('\n'); ft_putchar('\n');

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/16 16:14:46 by gwojda #+# #+# */ /* Created: 2016/12/16 16:14:46 by gwojda #+# #+# */
/* Updated: 2017/01/25 11:51:30 by gwojda ### ########.fr */ /* Updated: 2017/02/02 11:01:10 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */