diff options
author | Markus Armbruster <armbru@redhat.com> | 2013-01-22 11:07:59 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-01-30 11:14:46 +0100 |
commit | c3baa5f9e4f84bbc9ed9c3fe590835ecc8b0bf4a (patch) | |
tree | 508a9fe07284a2d176c018468c77a2779f0bd047 /readline.c | |
parent | d3f8e138c23ba082f87c96634d06b978473c1e9b (diff) |
readline: Fix unchecked strdup() by converting to g_strdup()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'readline.c')
-rw-r--r-- | readline.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/readline.c b/readline.c index a0c9638e4d..d6e04d4796 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]); + 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; } |