qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] linux-user: complete omission of removing u


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/3] linux-user: complete omission of removing uses of strdup
Date: Thu, 14 Jul 2016 14:13:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 07/04/2016 04:46, Wei Jiangang wrote:
> The 900cfbc just removed two unchecked uses of strdup
> in fill_psinfo and missed the rest in core_dump_filename.
> This patch fixes it.
> 
> Signed-off-by: Wei Jiangang <address@hidden>
> ---
>  linux-user/elfload.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index e47caff..6373320 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -2718,7 +2718,6 @@ static int core_dump_filename(const TaskState *ts, char 
> *buf,
>                                size_t bufsize)
>  {
>      char timestamp[64];
> -    char *filename = NULL;
>      char *base_filename = NULL;
>      struct timeval tv;
>      struct tm tm;
> @@ -2731,14 +2730,12 @@ static int core_dump_filename(const TaskState *ts, 
> char *buf,
>          return (-1);
>      }
>  
> -    filename = strdup(ts->bprm->filename);
> -    base_filename = strdup(basename(filename));
> +    base_filename = g_path_get_basename(ts->bprm->filename);
>      (void) strftime(timestamp, sizeof (timestamp), "%Y%m%d-%H%M%S",
>                      localtime_r(&tv.tv_sec, &tm));
>      (void) snprintf(buf, bufsize, "qemu_%s_%s_%d.core",
>                      base_filename, timestamp, (int)getpid());
> -    free(base_filename);
> -    free(filename);
> +    g_free(base_filename);
>  
>      return (0);
>  }
> 

This patch fell through the cracks, I think.

Paolo



reply via email to

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