qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 4/4] hw/display/tcx.c: Fix memory leak spotted by va


From: Shannon Zhao
Subject: [Qemu-devel] [PATCH 4/4] hw/display/tcx.c: Fix memory leak spotted by valgrind
Date: Thu, 28 May 2015 19:13:45 +0800

From: Shannon Zhao <address@hidden>

valgrind complains about:
==23693== 55 bytes in 1 blocks are definitely lost in loss record 1,277 of 2,014
==23693==    at 0x4C2845D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==23693==    by 0x21B93F: malloc_and_trace (vl.c:2556)
==23693==    by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==23693==    by 0x64DEFD7: g_strndup (in /usr/lib64/libglib-2.0.so.0.3600.3)
==23693==    by 0x650181A: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.3600.3)
==23693==    by 0x64DF0CC: g_strdup_vprintf (in 
/usr/lib64/libglib-2.0.so.0.3600.3)
==23693==    by 0x64DF188: g_strdup_printf (in 
/usr/lib64/libglib-2.0.so.0.3600.3)
==23693==    by 0x21A7B1: qemu_find_file (vl.c:2121)
==23693==    by 0x1E4F6E: tcx_realizefn (tcx.c:1013)
==23693==    by 0x26CC20: device_set_realized (qdev.c:1058)
==23693==    by 0x2B6766: property_set_bool (object.c:1514)
==23693==    by 0x2B5060: object_property_set (object.c:837)

Signed-off-by: Shannon Zhao <address@hidden
Signed-off-by: Shannon Zhao <address@hidden>
---
 hw/display/tcx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index a9f9f66..6c5e584 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -1014,6 +1014,7 @@ static void tcx_realizefn(DeviceState *dev, Error **errp)
     if (fcode_filename) {
         ret = load_image_targphys(fcode_filename, s->prom_addr,
                                   FCODE_MAX_ROM_SIZE);
+        g_free(fcode_filename);
         if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
             error_report("tcx: could not load prom '%s'", TCX_ROM_FILE);
         }
-- 
2.0.4





reply via email to

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