diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_m_loop.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ft_m_loop.c b/src/ft_m_loop.c index 7c6259c..2280cfd 100644 --- a/src/ft_m_loop.c +++ b/src/ft_m_loop.c @@ -30,8 +30,6 @@ uint8_t if (!(prog = ft_calloc(ft_strlen(line + 1), sizeof(char)))) return (0); - if (!(fin = malloc((ft_strlen(prog) + ft_strlen(buf)) * sizeof(char)))) - return (0); ft_memcpy(prog, line, (quote - line)); buf = ft_strdup(line + (quote - line) + 1); gnl = 1; @@ -42,14 +40,17 @@ uint8_t ft_sprintf(buf + ft_strlen(buf), "\n%s", line); } buf = ft_strtrim(buf, "\"'"); + if (!(fin = malloc((ft_strlen(prog) + ft_strlen(buf)) * sizeof(char)))) + return (0); fin = ft_strjoin(prog, buf); ft_p_line(fin, msh); ft_memdel((void*)&line); ft_memdel((void*)&buf); ft_memdel((void*)&fin); + ft_memdel((void*)&prog); ft_e_lcom(msh); ft_lcom_clear(&msh->curr); - return (1); /*got second quote, keep going*/ + return (1); } uint8_t |