From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T32WD-0005Ot-MY for qemu-devel@nongnu.org; Sun, 19 Aug 2012 06:14:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T32WC-0003Vh-Om for qemu-devel@nongnu.org; Sun, 19 Aug 2012 06:14:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T32WC-0003Vd-HD for qemu-devel@nongnu.org; Sun, 19 Aug 2012 06:14:04 -0400 Message-ID: <5030BCB4.2080607@redhat.com> Date: Sun, 19 Aug 2012 12:15:16 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1345323089-26232-1-git-send-email-sw@weilnetz.de> <503003BF.6040603@msgid.tls.msk.ru> In-Reply-To: <503003BF.6040603@msgid.tls.msk.ru> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qapi: Fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: Stefan Weil , qemu-devel@nongnu.org On 08/18/12 23:06, Michael Tokarev wrote: > On 19.08.2012 00:51, Stefan Weil wrote: > >> +++ b/qapi/opts-visitor.c >> @@ -416,7 +416,7 @@ opts_visitor_cleanup(OptsVisitor *ov) > >> g_hash_table_destroy(ov->unprocessed_opts); >> } >> g_free(ov->fake_id_opt); >> - memset(ov, '\0', sizeof *ov); >> + g_free(ov); > > Shouldn't the function be named opts_visitor_free() or .._destroy() > in this case? Or should maybe the caller free "ov" instead of > this function? To me it looks like either both free+rename shoud > be made, or none. All of - string-output-visitor.c - string-input-visitor.c - qmp-output-visitor.c - qmp-input-visitor.c - qapi-dealloc-visitor.c free the visitor in *_cleanup(). (Which is not to say they shouldn't all be renamed, only that the patch uni-forms opts-visitor with the rest.) Thanks, Laszlo