* [Qemu-trivial] [PATCH v2] hw/arm/omap_sx1.c: Fix memory leak spotted by valgrind
@ 2015-05-29 5:38 ` Shannon Zhao
0 siblings, 0 replies; 4+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:38 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, mjt, shannon.zhao
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==19440== 248 bytes in 1 blocks are definitely lost in loss record 2,340 of 2,934
==19440== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==19440== by 0x354793: malloc_and_trace (vl.c:2556)
==19440== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==19440== by 0x2833DB: sx1_init (omap_sx1.c:106)
==19440== by 0x2838C9: sx1_init_v2 (omap_sx1.c:217)
==19440== by 0x358B5E: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
This is split from my previous patchset [1]
[1] [PATCH 00/29] Fix memory leak relevant to calling qemu_allocate_irqs
---
hw/arm/omap_sx1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index 671e02c..4b0f7f9 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -103,7 +103,6 @@ static void sx1_init(MachineState *machine, const int version)
struct omap_mpu_state_s *mpu;
MemoryRegion *address_space = get_system_memory();
MemoryRegion *flash = g_new(MemoryRegion, 1);
- MemoryRegion *flash_1 = g_new(MemoryRegion, 1);
MemoryRegion *cs = g_new(MemoryRegion, 4);
static uint32_t cs0val = 0x00213090;
static uint32_t cs1val = 0x00215070;
@@ -165,6 +164,7 @@ static void sx1_init(MachineState *machine, const int version)
if ((version == 1) &&
(dinfo = drive_get(IF_PFLASH, 0, fl_idx)) != NULL) {
+ MemoryRegion *flash_1 = g_new(MemoryRegion, 1);
memory_region_init_ram(flash_1, NULL, "omap_sx1.flash1-0", flash1_size,
&error_abort);
vmstate_register_ram_global(flash_1);
--
2.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH v2] hw/arm/omap_sx1.c: Fix memory leak spotted by valgrind
@ 2015-05-29 5:38 ` Shannon Zhao
0 siblings, 0 replies; 4+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:38 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, mjt, shannon.zhao
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==19440== 248 bytes in 1 blocks are definitely lost in loss record 2,340 of 2,934
==19440== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==19440== by 0x354793: malloc_and_trace (vl.c:2556)
==19440== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==19440== by 0x2833DB: sx1_init (omap_sx1.c:106)
==19440== by 0x2838C9: sx1_init_v2 (omap_sx1.c:217)
==19440== by 0x358B5E: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
This is split from my previous patchset [1]
[1] [PATCH 00/29] Fix memory leak relevant to calling qemu_allocate_irqs
---
hw/arm/omap_sx1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index 671e02c..4b0f7f9 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -103,7 +103,6 @@ static void sx1_init(MachineState *machine, const int version)
struct omap_mpu_state_s *mpu;
MemoryRegion *address_space = get_system_memory();
MemoryRegion *flash = g_new(MemoryRegion, 1);
- MemoryRegion *flash_1 = g_new(MemoryRegion, 1);
MemoryRegion *cs = g_new(MemoryRegion, 4);
static uint32_t cs0val = 0x00213090;
static uint32_t cs1val = 0x00215070;
@@ -165,6 +164,7 @@ static void sx1_init(MachineState *machine, const int version)
if ((version == 1) &&
(dinfo = drive_get(IF_PFLASH, 0, fl_idx)) != NULL) {
+ MemoryRegion *flash_1 = g_new(MemoryRegion, 1);
memory_region_init_ram(flash_1, NULL, "omap_sx1.flash1-0", flash1_size,
&error_abort);
vmstate_register_ram_global(flash_1);
--
2.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-trivial] [PATCH v2] hw/arm/omap_sx1.c: Fix memory leak spotted by valgrind
2015-05-29 5:38 ` [Qemu-devel] " Shannon Zhao
@ 2015-05-30 13:55 ` Michael Tokarev
-1 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2015-05-30 13:55 UTC (permalink / raw)
To: Shannon Zhao, qemu-devel; +Cc: qemu-trivial, shannon.zhao
applied to -trivial, thanks!
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hw/arm/omap_sx1.c: Fix memory leak spotted by valgrind
@ 2015-05-30 13:55 ` Michael Tokarev
0 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2015-05-30 13:55 UTC (permalink / raw)
To: Shannon Zhao, qemu-devel; +Cc: qemu-trivial, shannon.zhao
applied to -trivial, thanks!
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-30 13:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-29 5:38 [Qemu-trivial] [PATCH v2] hw/arm/omap_sx1.c: Fix memory leak spotted by valgrind Shannon Zhao
2015-05-29 5:38 ` [Qemu-devel] " Shannon Zhao
2015-05-30 13:55 ` [Qemu-trivial] " Michael Tokarev
2015-05-30 13:55 ` [Qemu-devel] " Michael Tokarev
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.