]> git.proxmox.com Git - qemu.git/blobdiff - readline.c
PPC: e500: Change in-memory order of load blobs
[qemu.git] / readline.c
index a6c0039ad2c23bae5817f7ac37f1b1b73487800f..a0c9638e4d9634453964f9f3fcd581842f6685a9 100644 (file)
@@ -21,8 +21,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "readline.h"
-#include "monitor.h"
+#include "monitor/readline.h"
+#include "monitor/monitor.h"
 
 #define IS_NORM 0
 #define IS_ESC  1
@@ -248,8 +248,8 @@ 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 *));
+       memmove(rs->history, &rs->history[1],
+               (READLINE_MAX_CMDS - 1) * sizeof(char *));
        rs->history[READLINE_MAX_CMDS - 1] = NULL;
        idx = READLINE_MAX_CMDS - 1;
     }
@@ -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 */