[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] hw/smbus_eeprom.c : fix memory leak

From: Mark Wu
Subject: Re: [Qemu-devel] [PATCH] hw/smbus_eeprom.c : fix memory leak
Date: Fri, 02 Dec 2011 11:47:33 +0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110927 Red Hat/3.1.15-1.el6_1 Thunderbird/3.1.15

On 12/02/2011 11:23 AM, Li Zhi Hui wrote:
Signed-off-by: Li Zhi Hui<address@hidden>
  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));
+    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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]