All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Wu <wudxw@linux.vnet.ibm.com>
To: Li Zhi Hui <zhihuili@linux.vnet.ibm.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	stefanha@linux.vnet.ibm.com
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] hw/smbus_eeprom.c : fix memory leak
Date: Fri, 02 Dec 2011 11:47:33 +0800	[thread overview]
Message-ID: <4ED84A55.5060106@linux.vnet.ibm.com> (raw)
In-Reply-To: <1322796212-324-1-git-send-email-zhihuili@linux.vnet.ibm.com>

On 12/02/2011 11:23 AM, Li Zhi Hui wrote:
> Signed-off-by: Li Zhi Hui<zhihuili@linux.vnet.ibm.com>
> ---
>   hw/smbus_eeprom.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/hw/smbus_eeprom.c b/hw/smbus_eeprom.c
> index 5d080ab..d66fbbc 100644
> --- a/hw/smbus_eeprom.c
> +++ b/hw/smbus_eeprom.c
> @@ -142,4 +142,5 @@ void smbus_eeprom_init(i2c_bus *smbus, int nb_eeprom,
>           qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256));
>           qdev_init_nofail(eeprom);
>       }
> +    g_free(eeprom_buf);
>   }
The memory pointed by eeprom_buf is used as 'data' buf of 8 
SMBusEEPROMDevice after initialization.  And it calls qdev_init_nofail, 
which will exit on failure. it should be ok to leave it there. Anyway, 
you shouldn't free it in the initialization.

Mark.



WARNING: multiple messages have this Message-ID (diff)
From: Mark Wu <wudxw@linux.vnet.ibm.com>
To: Li Zhi Hui <zhihuili@linux.vnet.ibm.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	stefanha@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH] hw/smbus_eeprom.c : fix memory leak
Date: Fri, 02 Dec 2011 11:47:33 +0800	[thread overview]
Message-ID: <4ED84A55.5060106@linux.vnet.ibm.com> (raw)
In-Reply-To: <1322796212-324-1-git-send-email-zhihuili@linux.vnet.ibm.com>

On 12/02/2011 11:23 AM, Li Zhi Hui wrote:
> Signed-off-by: Li Zhi Hui<zhihuili@linux.vnet.ibm.com>
> ---
>   hw/smbus_eeprom.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/hw/smbus_eeprom.c b/hw/smbus_eeprom.c
> index 5d080ab..d66fbbc 100644
> --- a/hw/smbus_eeprom.c
> +++ b/hw/smbus_eeprom.c
> @@ -142,4 +142,5 @@ void smbus_eeprom_init(i2c_bus *smbus, int nb_eeprom,
>           qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256));
>           qdev_init_nofail(eeprom);
>       }
> +    g_free(eeprom_buf);
>   }
The memory pointed by eeprom_buf is used as 'data' buf of 8 
SMBusEEPROMDevice after initialization.  And it calls qdev_init_nofail, 
which will exit on failure. it should be ok to leave it there. Anyway, 
you shouldn't free it in the initialization.

Mark.

  reply	other threads:[~2011-12-02  3:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02  3:23 [Qemu-trivial] [PATCH] hw/smbus_eeprom.c : fix memory leak Li Zhi Hui
2011-12-02  3:23 ` [Qemu-devel] " Li Zhi Hui
2011-12-02  3:47 ` Mark Wu [this message]
2011-12-02  3:47   ` Mark Wu
2011-12-02  5:41   ` Zhi Hui Li

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=4ED84A55.5060106@linux.vnet.ibm.com \
    --to=wudxw@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=zhihuili@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.