Browse Source

[enh] leaks: free memory, fix.

Moul 3 years ago
parent
commit
a6b4bc3ff6
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/history.c
  2. 1 1
      src/term_edition.c

+ 1 - 1
src/history.c

@@ -43,7 +43,7 @@ t_hist	*new_hist(char *cmd)
 void	move_history(t_e *e, int side)
 {
 	get_history(e, side);
-	if (side == DOWN || e->hist->yng != NULL)
+	if (side == DOWN && e->hist->yng != NULL)
 	{
 		ft_strdel(&e->cmd);
 		e->cmd = e->hist->cmd;

+ 1 - 1
src/term_edition.c

@@ -41,7 +41,7 @@ void	suppr(t_e *e, int pos, int side)
 
 	snd = ft_strsub(e->cmd, pos, e->len);
 	e->cmd[pos - 1] = '\0';
-	e->cmd = ft_strjoinf(e->cmd, snd, 2);
+	e->cmd = ft_strjoinf(e->cmd, snd, 3);
 	if (side == -1)
 		term_action("le");
 	term_action("dc");