X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=readline.c;h=d6e04d4796ccc5f1e3e7f4a7d2883bcfc004d1f3;hb=92f2ca38b01578075208799dd2f060fcc3638ed4;hp=5fc9643c2bf23a22822594e92ae5c19e7faef6df;hpb=63e3555e80c31776285accbb4d0c14ae91c457dc;p=qemu.git diff --git a/readline.c b/readline.c index 5fc9643c2..d6e04d479 100644 --- a/readline.c +++ b/readline.c @@ -247,14 +247,14 @@ static void readline_hist_add(ReadLineState *rs, const char *cmdline) } if (idx == READLINE_MAX_CMDS) { /* Need to get one free slot */ - free(rs->history[0]); - memcpy(rs->history, &rs->history[1], - (READLINE_MAX_CMDS - 1) * sizeof(char *)); + g_free(rs->history[0]); + memmove(rs->history, &rs->history[1], + (READLINE_MAX_CMDS - 1) * sizeof(char *)); rs->history[READLINE_MAX_CMDS - 1] = NULL; idx = READLINE_MAX_CMDS - 1; } if (new_entry == NULL) - new_entry = strdup(cmdline); + new_entry = g_strdup(cmdline); rs->history[idx] = new_entry; rs->hist_entry = -1; }