From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L2YjU-0005vo-W9 for qemu-devel@nongnu.org; Tue, 18 Nov 2008 17:07:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L2YjS-0005uU-7i for qemu-devel@nongnu.org; Tue, 18 Nov 2008 17:07:40 -0500 Received: from [199.232.76.173] (port=57011 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2YjR-0005uM-TF for qemu-devel@nongnu.org; Tue, 18 Nov 2008 17:07:37 -0500 Received: from hs-out-0708.google.com ([64.233.178.251]:59744) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L2YjS-0001fX-1r for qemu-devel@nongnu.org; Tue, 18 Nov 2008 17:07:38 -0500 Received: by hs-out-0708.google.com with SMTP id k27so1610668hsc.2 for ; Tue, 18 Nov 2008 14:07:36 -0800 (PST) Message-ID: <49233CA5.2060705@codemonkey.ws> Date: Tue, 18 Nov 2008 16:07:33 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/4] uImage: free file data after copying into guest memory References: <1226956692-15962-1-git-send-email-hollisb@us.ibm.com> <09739678475eecbf3d9de512bf1dd13d07bd6642.1226955410.git.hollisb@us.ibm.com> In-Reply-To: <09739678475eecbf3d9de512bf1dd13d07bd6642.1226955410.git.hollisb@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Hollis Blanchard Hollis Blanchard wrote: > Signed-off-by: Hollis Blanchard > --- > loader.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/loader.c b/loader.c > index 8722909..7f4e69c 100644 > --- a/loader.c > +++ b/loader.c > @@ -399,6 +399,7 @@ int load_uboot(const char *filename, target_ulong *ep, int *is_linux) > } > > cpu_physical_memory_write_rom(hdr->ih_load, data, hdr->ih_size); > + qemu_free(data); > I notice that fd is also leaked in this path. I think a better fix is to eliminate the separate error path and introduce a return variable. The success path should just set that to hdr->ih_size. Regards, Anthony Liguori > > return hdr->ih_size; > >