Message ID | 1456998223-12356-7-git-send-email-arei.gonglei@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 03/03/2016 10:43, Gonglei wrote: > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > --- > hw/i2c/smbus_eeprom.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c > index 5b7bd89..83c6b27 100644 > --- a/hw/i2c/smbus_eeprom.c > +++ b/hw/i2c/smbus_eeprom.c > @@ -156,4 +156,6 @@ void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom, > qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); > qdev_init_nofail(eeprom); > } > + > + g_free(eeprom_buf); > } > This is wrong, eeprom_buf is passed to the device through qdev_prop_set_ptr. Paolo
> Subject: Re: [PATCH 6/6] smbus: fix memory leak > > > > On 03/03/2016 10:43, Gonglei wrote: > > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > > --- > > hw/i2c/smbus_eeprom.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c > > index 5b7bd89..83c6b27 100644 > > --- a/hw/i2c/smbus_eeprom.c > > +++ b/hw/i2c/smbus_eeprom.c > > @@ -156,4 +156,6 @@ void smbus_eeprom_init(I2CBus *smbus, int > nb_eeprom, > > qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); > > qdev_init_nofail(eeprom); > > } > > + > > + g_free(eeprom_buf); > > } > > > > This is wrong, eeprom_buf is passed to the device through qdev_prop_set_ptr. > Oops, right, NACK. Thanks! Regards, -Gonglei
diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index 5b7bd89..83c6b27 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -156,4 +156,6 @@ void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom, qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); qdev_init_nofail(eeprom); } + + g_free(eeprom_buf); }
Signed-off-by: Gonglei <arei.gonglei@huawei.com> --- hw/i2c/smbus_eeprom.c | 2 ++ 1 file changed, 2 insertions(+)