diff --git a/42sh/src/exec/pfree_cond.c b/42sh/src/exec/pfree_cond.c index 69c185e9..0042a072 100644 --- a/42sh/src/exec/pfree_cond.c +++ b/42sh/src/exec/pfree_cond.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 02:26:31 by wescande #+# #+# */ -/* Updated: 2017/03/20 15:49:52 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 18:45:11 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,5 +15,6 @@ int pfree_cond(t_process *p) { btree_del(&p->data.d_while.content, &ast_free); + btree_del(&p->data.d_while.condition, &ast_free); return (0); } diff --git a/42sh/src/exec/process_launch.c b/42sh/src/exec/process_launch.c index 4a7c5825..4566bd1b 100644 --- a/42sh/src/exec/process_launch.c +++ b/42sh/src/exec/process_launch.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/13 22:21:19 by jhalford #+# #+# */ -/* Updated: 2017/03/20 15:58:12 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 18:41:25 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -58,6 +58,7 @@ int process_launch(t_process *p) if (!(pid = do_the_fork_if_i_have_to(p))) { process_resetfds(p); + process_free(p, 0); return (1); } p->pid = pid; diff --git a/42sh/src/exec/process_set.c b/42sh/src/exec/process_set.c index 15d7d29f..2c12279c 100644 --- a/42sh/src/exec/process_set.c +++ b/42sh/src/exec/process_set.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */ -/* Updated: 2017/03/20 17:07:01 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 18:50:44 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -50,6 +50,7 @@ int process_set(t_process *p, t_btree *ast) int op; int fds[2]; + ft_bzero(p, sizeof(t_process)); exec = &data_singleton()->exec; op = pop(&exec->op_stack); if ((EXEC_IS_AND_IF(exec->attrs) diff --git a/42sh/src/job_control/process_free.c b/42sh/src/job_control/process_free.c index 8ffb939d..49e4d7fb 100644 --- a/42sh/src/job_control/process_free.c +++ b/42sh/src/job_control/process_free.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */ -/* Updated: 2017/03/20 12:55:37 by jhalford ### ########.fr */ +/* Updated: 2017/03/20 18:58:03 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,5 +21,6 @@ void process_free(void *content, size_t content_size) if (p->map.free) (p->map.free)(p); ft_lstdel(&p->redirs, redir_free); - free(p); + if (content_size) + free(p); }