summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-05-22 19:59:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-05-22 19:59:03 (GMT)
commit1c96d0ae943b45f71954c1772aa94f78bafdf656 (patch)
tree6f8ec37cd76ac07e986f08a65c588b04051cedad
parent16f07d7609b71e7cbbed0dce438ed94fb96d089e (diff)
Fixed a memory leak with the built list of disassembling areas.
-rw-r--r--ChangeLog5
-rw-r--r--src/analysis/disass/area.c18
2 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 836a798..1a4b6cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+17-05-22 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/analysis/disass/area.c:
+ Fix a memory leak with the built list of disassembling areas.
+
17-05-21 Cyrille Bagard <nocbos@gmail.com>
* src/arch/instruction-int.h:
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index e19a4c0..030d58e 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -1259,7 +1259,20 @@ static void g_area_collector_dispose(GAreaCollector *collector)
static void g_area_collector_finalize(GAreaCollector *collector)
{
- if (collector->run == (run_task_fc)g_area_collector_do_collect)
+ if (collector->run == (run_task_fc)g_area_collector_do_compute)
+ {
+ /**
+ * Il s'agit de la seule procédure où les zones mises en place sont
+ * propres à un collecteur donné unique.
+ *
+ * Dans les autres cas, la liste est globale et partagée.
+ */
+ if (collector->areas != NULL)
+ free(collector->areas);
+
+ }
+
+ else if (collector->run == (run_task_fc)g_area_collector_do_collect)
{
if (collector->collected != NULL)
free(collector->collected);
@@ -1565,7 +1578,6 @@ mem_area *collect_memory_areas(wgroup_id_t gid, GtkStatusStack *status, GLoadedB
collectors[i] = g_area_collector_new_intro(id, binary, first, last, closing);
- g_object_ref(G_OBJECT(collectors[i]));
g_work_queue_schedule_work(queue, G_DELAYED_WORK(collectors[i]), gid);
}
@@ -1794,7 +1806,6 @@ void populate_fresh_memory_areas(wgroup_id_t gid, GtkStatusStack *status, mem_ar
collectors[i] = g_area_collector_new_insert(id, areas, count, info, start, stop);
- g_object_ref(G_OBJECT(collectors[i]));
g_work_queue_schedule_work(queue, G_DELAYED_WORK(collectors[i]), gid);
}
@@ -1933,7 +1944,6 @@ GArchInstruction **collect_disassembled_instructions(wgroup_id_t gid, GtkStatusS
collectors[i] = g_area_collector_new_outro(id, list, begin, end);
- g_object_ref(G_OBJECT(collectors[i]));
g_work_queue_schedule_work(queue, G_DELAYED_WORK(collectors[i]), gid);
}