Received: from [140.186.70.92] (port=46057 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oewi1-0002ne-PE for qemu-devel@nongnu.org; Fri, 30 Jul 2010 17:01:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oewi0-0005R2-EZ for qemu-devel@nongnu.org; Fri, 30 Jul 2010 17:01:37 -0400 Received: from hall.aurel32.net ([88.191.82.174]:49041) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oewi0-0005Q6-9b for qemu-devel@nongnu.org; Fri, 30 Jul 2010 17:01:36 -0400 Date: Fri, 30 Jul 2010 23:01:24 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] savevm: Fix memory leak of compat struct Message-ID: <20100730210124.GA20459@volta.aurel32.net> References: <20100721143509.4671.66441.stgit@localhost6.localdomain6> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20100721143509.4671.66441.stgit@localhost6.localdomain6> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: zamsden@redhat.com, qemu-devel@nongnu.org On Wed, Jul 21, 2010 at 08:35:31AM -0600, Alex Williamson wrote: > Forgot to check for and free these. > > Found-by: Zachary Amsden > Signed-off-by: Alex Williamson > --- > > 0.13 Candidate > > savevm.c | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) Thanks, applied. > diff --git a/savevm.c b/savevm.c > index ee27989..1612794 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -1126,6 +1126,9 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque) > QTAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) { > if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { > QTAILQ_REMOVE(&savevm_handlers, se, entry); > + if (se->compat) { > + qemu_free(se->compat); > + } > qemu_free(se); > } > } > @@ -1193,6 +1196,9 @@ void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd, > QTAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) { > if (se->vmsd == vmsd && se->opaque == opaque) { > QTAILQ_REMOVE(&savevm_handlers, se, entry); > + if (se->compat) { > + qemu_free(se->compat); > + } > qemu_free(se); > } > } > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net