qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [Qemu-devel] [PATCH 04/11] readline: Fix unchecked st


From: Eric Blake
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 04/11] readline: Fix unchecked strdup() by converting to g_strdup()
Date: Wed, 16 Jan 2013 08:51:32 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 01/16/2013 07:36 AM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  readline.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/readline.c b/readline.c
> index a0c9638..d6e04d4 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);

As long as you are converting tabs to spaces, you should also be adding {}.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]