diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 8 | ||||
-rw-r--r-- | src/analysis/decomp/decompiler.c | 5 | ||||
-rw-r--r-- | src/analysis/disass/area.c | 6 | ||||
-rw-r--r-- | src/analysis/disass/disassembler.c | 55 | ||||
-rw-r--r-- | src/analysis/disass/fetch.c | 2 | ||||
-rw-r--r-- | src/analysis/project.c | 2 |
6 files changed, 69 insertions, 9 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index e466c33..2563355 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -1461,9 +1461,13 @@ bool g_loaded_binary_attach_debug_info(GLoadedBinary *binary, GBinContent *conte GExeFormat *g_loaded_binary_get_format(const GLoadedBinary *binary) { - /* TODO : inc ref ! */ + GExeFormat *result; /* Instance à retourner */ - return binary->format; + result = binary->format; + + g_object_ref(G_OBJECT(result)); + + return result; } diff --git a/src/analysis/decomp/decompiler.c b/src/analysis/decomp/decompiler.c index bca45e1..04ae7c4 100644 --- a/src/analysis/decomp/decompiler.c +++ b/src/analysis/decomp/decompiler.c @@ -202,8 +202,7 @@ static void prepare_all_routines_for_decomp(const GLoadedBinary *binary, const c } - - + g_object_unref(G_OBJECT(format)); } @@ -237,8 +236,10 @@ GCodeBuffer *decompile_all_from_file(const GLoadedBinary *binary, const char *fi format = g_loaded_binary_get_format(binary); + g_binary_format_decompile(G_BIN_FORMAT(format), result, filename); + g_object_unref(G_OBJECT(format)); return result; 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); diff --git a/src/analysis/project.c b/src/analysis/project.c index a3c004d..7b4f621 100644 --- a/src/analysis/project.c +++ b/src/analysis/project.c @@ -631,6 +631,8 @@ void g_study_project_attach_binary(GStudyProject *project, GLoadedBinary *binary } + g_object_unref(G_OBJECT(format)); + return FALSE; } |