rip leaks

This commit is contained in:
gwojda 2017-03-14 16:37:40 +01:00
parent 864b8ec120
commit 0d4f441670
6 changed files with 20 additions and 13 deletions

@ -1 +1 @@
Subproject commit b209bb1fb718a68256253d5ab5ff69a46a90d5d6 Subproject commit 9382dc10fdb91892ab26604a5776e5301ab88b71

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */ /* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */
/* Updated: 2017/03/13 14:52:53 by jhalford ### ########.fr */ /* Updated: 2017/03/14 15:22:44 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -36,9 +36,9 @@ int builtin_exit(const char *path, char *const av[], char *const envp[])
ft_save_termios(-1); ft_save_termios(-1);
ft_free_hash_table(); ft_free_hash_table();
free_history_list(data_singleton()->line.list_beg); free_history_list(data_singleton()->line.list_beg);
data_exit();
if (SH_IS_INTERACTIVE(data_singleton()->opts)) if (SH_IS_INTERACTIVE(data_singleton()->opts))
tcsetattr(STDIN, TCSANOW, &data_singleton()->jobc.shell_tmodes); tcsetattr(STDIN, TCSANOW, &data_singleton()->jobc.shell_tmodes);
data_exit();
exit(status); exit(status);
return (0); return (0);
} }

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/08 17:20:01 by gwojda #+# #+# */ /* Created: 2017/03/08 17:20:01 by gwojda #+# #+# */
/* Updated: 2017/03/10 17:43:15 by gwojda ### ########.fr */ /* Updated: 2017/03/14 14:00:30 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -63,7 +63,6 @@ int c_glob_matching(void)
glob_echap = (unsigned char *)ft_strnew(ft_strlen(str) >> 3); glob_echap = (unsigned char *)ft_strnew(ft_strlen(str) >> 3);
ft_bzero(glob_echap, ft_strlen(str) >> 3); ft_bzero(glob_echap, ft_strlen(str) >> 3);
ss_glob = glob(current_word, glob_echap, glob_echap, 1); ss_glob = glob(current_word, glob_echap, glob_echap, 1);
// ss_glob = glob(current_word, glob_echap, glob_echap);
free(current_word); free(current_word);
if (!*ss_glob || !**ss_glob || !ft_strncmp(str + pos, *ss_glob, ft_strlen(*ss_glob))) if (!*ss_glob || !**ss_glob || !ft_strncmp(str + pos, *ss_glob, ft_strlen(*ss_glob)))
return (0); return (0);

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/17 11:37:47 by gwojda #+# #+# */ /* Created: 2016/12/17 11:37:47 by gwojda #+# #+# */
/* Updated: 2017/03/13 14:47:06 by jhalford ### ########.fr */ /* Updated: 2017/03/14 15:20:22 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,11 +18,15 @@ void free_history_list(t_list_history *head)
if (!head) if (!head)
return ; return ;
DG("free hist");
if (head->next)
free(head->next);
while (head) while (head)
{ {
ft_strdel(&head->str); ft_strdel(&head->str);
prev = head; prev = head;
head = head->next; head = head->prev;
free(prev);
} }
} }

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */ /* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */
/* Updated: 2017/03/14 12:32:38 by gwojda ### ########.fr */ /* Updated: 2017/03/14 16:00:05 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -24,16 +24,18 @@ static int promt_git_status(int fd)
line = ft_strdup(ft_strrchr(line, '/') + 1); line = ft_strdup(ft_strrchr(line, '/') + 1);
else else
line = ft_strdup(line + 3); line = ft_strdup(line + 3);
ft_printf("\x1b[38;5;47mgit:(\x1b[38;5;203m%s\x1b[38;5;47m)", line);
free(tmp); free(tmp);
ft_printf("\x1b[38;5;47mgit:(\x1b[38;5;203m%s\x1b[38;5;47m)", line);
if (!get_next_line(fd, &tmp)) if (!get_next_line(fd, &tmp))
printf("\x1b[38;5;83m %C ", L''); printf("\x1b[38;5;83m %C ", L'');
else else
{ {
printf("\x1b[38;5;1m %C ", L''); printf("\x1b[38;5;1m %C ", L'');
while (get_next_line(fd, &tmp)) free(tmp);
free(tmp);
} }
while (get_next_line(fd, &tmp))
free(tmp);
free(tmp);
len = ft_strlen(line); len = ft_strlen(line);
ft_strdel(&line); ft_strdel(&line);
fflush(NULL); fflush(NULL);

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */ /* ::: :::::::: */
/* data_exit.c :+: :+: :+: */ /* data_exit.c :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */ /* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */
/* Updated: 2017/01/22 17:20:29 by ariard ### ########.fr */ /* Updated: 2017/03/14 15:21:17 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -19,4 +19,6 @@ void data_exit(void)
data = data_singleton(); data = data_singleton();
/* ft_strdel(&data->line.input); */ /* ft_strdel(&data->line.input); */
ft_sstrfree(data->env); ft_sstrfree(data->env);
ft_sstrfree(data->argv);
free(data_singleton());
} }