X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=readline.c;h=540cd8a025d145dd3fe28e538bd79f9198e9c5fc;hb=refs%2Fheads%2Fstable-1.1;hp=6a3160aba53058f072d780f7bdbc241cff417361;hpb=aec7c6dc683314d1e5bed09a9cc98dab086ead82;p=qemu.git diff --git a/readline.c b/readline.c index 6a3160aba..540cd8a02 100644 --- a/readline.c +++ b/readline.c @@ -236,7 +236,7 @@ static void readline_hist_add(ReadLineState *rs, const char *cmdline) new_entry = hist_entry; /* Put this entry at the end of history */ memmove(&rs->history[idx], &rs->history[idx + 1], - (READLINE_MAX_CMDS - idx + 1) * sizeof(char *)); + (READLINE_MAX_CMDS - (idx + 1)) * sizeof(char *)); rs->history[READLINE_MAX_CMDS - 1] = NULL; for (; idx < READLINE_MAX_CMDS; idx++) { if (rs->history[idx] == NULL) @@ -337,6 +337,9 @@ static void readline_completion(ReadLineState *rs) } readline_show_prompt(rs); } + for (i = 0; i < rs->nb_completions; i++) { + g_free(rs->completions[i]); + } } /* return true if command handled */