qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: Hollis Blanchard <hollisb@us.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 1/4] uImage: free file data after copying into guest memory
Date: Tue, 18 Nov 2008 16:07:33 -0600	[thread overview]
Message-ID: <49233CA5.2060705@codemonkey.ws> (raw)
In-Reply-To: <09739678475eecbf3d9de512bf1dd13d07bd6642.1226955410.git.hollisb@us.ibm.com>

Hollis Blanchard wrote:
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
> ---
>  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;
>  
>   

      parent reply	other threads:[~2008-11-18 22:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-17 21:18 [Qemu-devel] improvements in uImage loading Hollis Blanchard
2008-11-17 21:18 ` [Qemu-devel] [PATCH 1/4] uImage: free file data after copying into guest memory Hollis Blanchard
2008-11-17 21:18   ` [Qemu-devel] [PATCH 2/4] uImage: implement gzip support Hollis Blanchard
2008-11-17 21:18     ` [Qemu-devel] [PATCH 3/4] uImage: return base load address Hollis Blanchard
2008-11-17 21:18       ` [Qemu-devel] [PATCH 4/4] uImage: rename load_uboot() to load_uimage() Hollis Blanchard
2008-11-17 21:30     ` [Qemu-devel] [PATCH 2/4] uImage: implement gzip support François Revol
2008-11-17 21:38       ` Hollis Blanchard
2008-11-17 22:07     ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-17 22:30       ` François Revol
2008-11-17 22:45         ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-17 23:14           ` François Revol
2008-11-17 22:35       ` Hollis Blanchard
2008-11-17 22:39         ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-18 16:20           ` Hollis Blanchard
2008-11-18 22:04     ` Anthony Liguori
2008-11-18 22:17       ` Hollis Blanchard
2008-11-18 22:44         ` Anthony Liguori
2008-11-18 22:07   ` Anthony Liguori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49233CA5.2060705@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=hollisb@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).