qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [PATCH v2 08/11] qemu-log: Plug trivial memory leak i


From: Stefan Hajnoczi
Subject: Re: [Qemu-trivial] [PATCH v2 08/11] qemu-log: Plug trivial memory leak in cpu_set_log_filename()
Date: Thu, 17 Jan 2013 12:24:20 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Jan 16, 2013 at 06:32:17PM +0100, Markus Armbruster wrote:
> diff --git a/qemu-log.c b/qemu-log.c
> index 64a1b88..30c8b01 100644
> --- a/qemu-log.c
> +++ b/qemu-log.c
> @@ -21,10 +21,12 @@
>  #include "qemu/log.h"
>  
>  #ifdef WIN32
> -static const char *logfilename = "qemu.log";
> +#define DEFAULT_LOGFILENAME "qemu.log"
>  #else
> -static const char *logfilename = "/tmp/qemu.log";
> +#define DEFAULT_LOGFILENAME "/tmp/qemu.log"
>  #endif
> +
> +static const char *logfilename;
[...]
> @@ -84,6 +88,7 @@ void qemu_set_log(int log_flags, bool use_own_buffers)
>  
>  void cpu_set_log_filename(const char *filename)
>  {
> +    g_free((void *)logfilename);

Might as well drop the const from the variable declaration to indicate
that we allocate/free this string.

Stefan



reply via email to

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