summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/p_redirs_heredoc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/p_redirs_heredoc.c b/src/p_redirs_heredoc.c
index 7c2ef90..fd5b399 100644
--- a/src/p_redirs_heredoc.c
+++ b/src/p_redirs_heredoc.c
@@ -35,13 +35,16 @@ char
m_prompt_psx(2, msh);
gnl = get_next_line(msh->fd, &line);
if (ft_strncmp(path, line, ft_strlen(path) + 1) != 0)
- return (heredoc);
+ break ;
if ((heredoc = ft_nrealloc(heredoc, ft_strlen(heredoc),
ft_strlen(heredoc) + ft_strlen(line) + 2)) == NULL)
- return (heredoc);
+ break ;
ft_strlcpy(heredoc + ft_strlen(heredoc), line, ft_strlen(line) + 1);
heredoc[ft_strlen(heredoc) + 1] = C_NUL;
heredoc[ft_strlen(heredoc)] = C_LF;
+ ft_memdel((void*)&line);
+
}
+ ft_memdel((void*)&line);
return (heredoc);
}