From 1b3870cc58fc4893d12b45689a4efe7f2bbe272f Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 27 Sep 2020 21:28:03 +0200 Subject: later --- src/p_redirs_heredoc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/p_redirs_heredoc.c') 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); } -- cgit v1.2.3