Received: from eggs.gnu.org ([208.118.235.92]:48731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvnfy-0006nO-IX for qemu-devel@nongnu.org; Thu, 17 Jan 2013 06:30:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tvnfr-00048N-Gd for qemu-devel@nongnu.org; Thu, 17 Jan 2013 06:30:30 -0500 Date: Thu, 17 Jan 2013 12:24:20 +0100 From: Stefan Hajnoczi Message-ID: <20130117112420.GJ2586@stefanha-thinkpad.redhat.com> References: <1358357540-29862-1-git-send-email-armbru@redhat.com> <1358357540-29862-9-git-send-email-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1358357540-29862-9-git-send-email-armbru@redhat.com> Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 08/11] qemu-log: Plug trivial memory leak in cpu_set_log_filename() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org 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