summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-11-03 14:01:38 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-11-03 14:01:38 (GMT)
commite5d58e1f70405012fd8fbe8d61937f92fa3583a9 (patch)
tree29b555020a18df0e91ffd10460693bbe40bed729 /src/analysis/disass
parent25576d8dd565547fe1178f7faa583a36718f98f8 (diff)
Counted references for each provided binary format.
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/area.c6
-rw-r--r--src/analysis/disass/disassembler.c55
-rw-r--r--src/analysis/disass/fetch.c2
3 files changed, 58 insertions, 5 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index fed1cc9..52ba933 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -143,9 +143,9 @@ static void fini_mem_area(mem_area *area)
phys_t len; /* Etendue du parcours total */
phys_t i; /* Boucle de parcours */
- //g_object_unref(area->format); /* FIXME */
+ g_object_unref(area->format);
g_object_unref(area->content);
- //g_object_unref(area->proc); /* FIXME */
+ g_object_unref(area->proc);
delete_bit_field(area->processed);
@@ -896,7 +896,7 @@ mem_area *compute_memory_areas(const GLoadedBinary *binary, phys_t bin_length, s
if (exe_ranges != NULL)
free(exe_ranges);
- /// FIXME g_object_unref(G_OBJECT(format));
+ g_object_unref(G_OBJECT(format));
return result;
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index f036be6..8a19f9d 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -75,6 +75,12 @@ static void g_delayed_disassembly_class_init(GDelayedDisassemblyClass *);
/* Initialise une tâche de désassemblage différé. */
static void g_delayed_disassembly_init(GDelayedDisassembly *);
+/* Supprime toutes les références externes. */
+static void g_delayed_disassembly_dispose(GDelayedDisassembly *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_delayed_disassembly_finalize(GDelayedDisassembly *);
+
/* Crée une tâche de désassemblage différé. */
static GDelayedDisassembly *g_delayed_disassembly_new(GLoadedBinary *, GArchInstruction **, GCodeBuffer *);
@@ -120,8 +126,14 @@ G_DEFINE_TYPE(GDelayedDisassembly, g_delayed_disassembly, G_TYPE_DELAYED_WORK);
static void g_delayed_disassembly_class_init(GDelayedDisassemblyClass *klass)
{
+ GObjectClass *object; /* Autre version de la classe */
GDelayedWorkClass *work; /* Version en classe parente */
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_delayed_disassembly_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_delayed_disassembly_finalize;
+
work = G_DELAYED_WORK_CLASS(klass);
work->run = (run_task_fc)g_delayed_disassembly_process;
@@ -149,6 +161,46 @@ static void g_delayed_disassembly_init(GDelayedDisassembly *disass)
/******************************************************************************
* *
+* Paramètres : binary = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_delayed_disassembly_dispose(GDelayedDisassembly *disass)
+{
+ g_object_unref(G_OBJECT(disass->format));
+
+ G_OBJECT_CLASS(g_delayed_disassembly_parent_class)->dispose(G_OBJECT(disass));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : disass = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_delayed_disassembly_finalize(GDelayedDisassembly *disass)
+{
+ G_OBJECT_CLASS(g_delayed_disassembly_parent_class)->finalize(G_OBJECT(disass));
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : binary = binaire chargé en attente des résultats. *
* format = format du binaire représenté. *
* instrs = emplacement pour la liste d'instructions. *
@@ -338,7 +390,6 @@ static void g_delayed_disassembly_process(GDelayedDisassembly *disass, GtkStatus
- //format = G_BIN_FORMAT(g_loaded_binary_get_format(binary));
proc = g_loaded_binary_get_processor(disass->binary);
ctx = g_arch_processor_get_context(proc);
@@ -700,6 +751,8 @@ void disassemble_binary(GLoadedBinary *binary, GArchInstruction **instrs, GCodeB
checksum = g_binary_content_get_checksum(content);
g_object_unref(G_OBJECT(content));
+ g_object_unref(G_OBJECT(format));
+
build_disass_prologue(*buffer, g_binary_content_describe(content, true), checksum);
disass = g_delayed_disassembly_new(binary, instrs, *buffer);
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c
index aab7258..55a23b6 100644
--- a/src/analysis/disass/fetch.c
+++ b/src/analysis/disass/fetch.c
@@ -471,7 +471,7 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GProcC
/* Libérations finales */
- //g_object_unref(G_OBJECT(template.format));
+ g_object_unref(G_OBJECT(template.format));
release_mem_areas(template.areas, template.count);