summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analysis/binary.c8
-rw-r--r--src/analysis/decomp/decompiler.c5
-rw-r--r--src/analysis/disass/area.c6
-rw-r--r--src/analysis/disass/disassembler.c55
-rw-r--r--src/analysis/disass/fetch.c2
-rw-r--r--src/analysis/project.c2
-rw-r--r--src/gtkext/gtkbinarystrip.c4
-rw-r--r--src/gtkext/gtkbufferview.c7
-rw-r--r--src/gtkext/gtkgraphview.c1
-rw-r--r--src/gtkext/gtkstatusstack.c4
-rw-r--r--src/gui/dialogs/gotox.c4
-rw-r--r--src/gui/dialogs/shellcode.c2
-rw-r--r--src/gui/panels/bookmarks.c9
-rw-r--r--src/gui/panels/strings.c3
-rw-r--r--src/gui/panels/symbols.c4
-rw-r--r--src/gui/tb/source.c3
-rw-r--r--src/panels/breaks.c3
17 files changed, 99 insertions, 23 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;
}
diff --git a/src/gtkext/gtkbinarystrip.c b/src/gtkext/gtkbinarystrip.c
index 1cf2450..fff6a78 100644
--- a/src/gtkext/gtkbinarystrip.c
+++ b/src/gtkext/gtkbinarystrip.c
@@ -233,6 +233,7 @@ static void gtk_binary_strip_size_allocate(GtkWidget *widget, GtkAllocation *all
strip->cursor_pos = 0;
g_object_unref(G_OBJECT(layer));
+ g_object_unref(G_OBJECT(format));
}
@@ -290,6 +291,7 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto
}
g_object_unref(G_OBJECT(layer));
+ g_object_unref(G_OBJECT(format));
return FALSE;
@@ -338,6 +340,7 @@ static gboolean gtk_binary_strip_draw(GtkWidget *widget, cairo_t *cr)
g_portion_layer_draw(layer, context, cr, &full);
g_object_unref(G_OBJECT(layer));
+ g_object_unref(G_OBJECT(format));
/* Dessin de la position */
@@ -412,6 +415,7 @@ static gboolean gtk_binary_strip_query_tooltip(GtkWidget *widget, gint x, gint y
result = g_portion_layer_query_tooltip(layer, x, y, &area, tooltip);
g_object_unref(G_OBJECT(layer));
+ g_object_unref(G_OBJECT(format));
}
else result = FALSE;
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c
index caa7eb0..1f4399a 100644
--- a/src/gtkext/gtkbufferview.c
+++ b/src/gtkext/gtkbufferview.c
@@ -558,6 +558,7 @@ static gboolean gtk_buffer_view_key_press(GtkWidget *widget, GdkEventKey *event)
static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard, GtkTooltip *tooltip)
{
gboolean result; /* Bilan à retourner */
+ GBinFormat *format; /* Format du fichier binaire */
GtkBufferView *view; /* Autre version du composant */
gint real_x; /* Abscisse absolue réelle */
gint real_y; /* Ordonnée absolue réelle */
@@ -565,7 +566,6 @@ static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y,
GObject *creator; /* Créateur à l'orgine du seg. */
virt_t virt; /* Adresse virtuelle */
vmpa2t addr; /* Adresse de destination */
- GBinFormat *format; /* Format du fichier binaire */
GBinSymbol *target_sym; /* Symbole présent à l'adresse */
GBinSymbol *next_sym; /* Symbole suivant l'adresse */
GCodeBuffer *buffer; /* Tampon où lire les lignes */
@@ -581,6 +581,8 @@ static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y,
result = FALSE;
+ format = NULL;
+
view = GTK_BUFFER_VIEW(widget);
/* Récupération de la destination pointée */
@@ -692,6 +694,9 @@ static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y,
g_object_unref(G_OBJECT(line));
*/
+ if (format != NULL)
+ g_object_unref(G_OBJECT(format));
+
return result;
}
diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c
index 3136cf4..fc307a2 100644
--- a/src/gtkext/gtkgraphview.c
+++ b/src/gtkext/gtkgraphview.c
@@ -782,6 +782,7 @@ static void gtk_graph_view_define_main_address(GtkGraphView *view, const vmpa2t
change_editor_items_current_view_content(GTK_VIEW_PANEL(view));
+ g_object_unref(G_OBJECT(format));
}
diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c
index 930fa4a..ac1716e 100644
--- a/src/gtkext/gtkstatusstack.c
+++ b/src/gtkext/gtkstatusstack.c
@@ -609,9 +609,7 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL
gssuci_useless:
- //g_object_unref(G_OBJECT(format));
-
- ;
+ g_object_unref(G_OBJECT(format));
}
diff --git a/src/gui/dialogs/gotox.c b/src/gui/dialogs/gotox.c
index 340da5c..02f1a02 100644
--- a/src/gui/dialogs/gotox.c
+++ b/src/gui/dialogs/gotox.c
@@ -245,6 +245,8 @@ GtkWidget *create_gotox_dialog_for_entry_points(GtkWindow *parent, GLoadedBinary
}
+ g_object_unref(G_OBJECT(format));
+
g_object_unref(G_OBJECT(store));
gtk_dialog_set_response_sensitive(GTK_DIALOG(result), GTK_RESPONSE_OK, has_entry_points);
@@ -402,6 +404,8 @@ static void add_new_location_to_list(GtkTreeStore *store, GLoadedBinary *binary,
}
+ g_object_unref(G_OBJECT(format));
+
}
/* Image de représentation */
diff --git a/src/gui/dialogs/shellcode.c b/src/gui/dialogs/shellcode.c
index faf3bdf..5c1a33c 100644
--- a/src/gui/dialogs/shellcode.c
+++ b/src/gui/dialogs/shellcode.c
@@ -222,6 +222,8 @@ static void export_assistant_close(GtkAssistant *assistant, GObject *ref)
*/
gtk_widget_destroy(GTK_WIDGET(assistant));
+ g_object_unref(G_OBJECT(format));
+
}
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c
index eaa2168..893c1bd 100644
--- a/src/gui/panels/bookmarks.c
+++ b/src/gui/panels/bookmarks.c
@@ -573,7 +573,6 @@ static void on_collection_content_changed(GDbCollection *collec, DBAction action
GtkTreeStore *store; /* Modèle de gestion */
- GExeFormat *format; /* Format du fichier binaire */
GArchProcessor *proc; /* Architecture du binaire */
MemoryDataSize msize; /* Taille par défaut */
@@ -590,18 +589,10 @@ static void on_collection_content_changed(GDbCollection *collec, DBAction action
{
store = GTK_TREE_STORE(gtk_tree_view_get_model(panel->treeview));
- format = g_loaded_binary_get_format(panel->binary);
-
-
proc = g_loaded_binary_get_processor(panel->binary);
msize = g_arch_processor_get_memory_size(proc);
g_object_unref(G_OBJECT(proc));
-
-
-
-
-
addr = g_db_bookmark_get_address(bookmark);
vmpa2_phys_to_string(addr, msize, phys, NULL);
diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c
index 5d25b09..a651fff 100644
--- a/src/gui/panels/strings.c
+++ b/src/gui/panels/strings.c
@@ -560,8 +560,9 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin
}
- g_object_unref(G_OBJECT(layer));
g_object_unref(G_OBJECT(content));
+ g_object_unref(G_OBJECT(layer));
+ g_object_unref(G_OBJECT(format));
}
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index ac2a703..4fffe35 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -706,6 +706,8 @@ static void reload_symbols_for_new_list_view(GSymbolsPanel *panel)
}
+ g_object_unref(G_OBJECT(format));
+
}
@@ -918,6 +920,8 @@ static void reload_symbols_for_new_tree_view(GSymbolsPanel *panel)
}
+ g_object_unref(G_OBJECT(format));
+
}
diff --git a/src/gui/tb/source.c b/src/gui/tb/source.c
index 0685368..02ed643 100644
--- a/src/gui/tb/source.c
+++ b/src/gui/tb/source.c
@@ -260,6 +260,9 @@ static void update_source_item_binary(GEditorItem *item, GLoadedBinary *binary)
g_signal_handlers_unblock_by_func(combo, G_CALLBACK(change_selected_source), item);
//gtk_combo_box_set_active(combo, defsrc);
+
+ g_object_unref(G_OBJECT(format));
+
#endif
}
diff --git a/src/panels/breaks.c b/src/panels/breaks.c
index 6b11f1e..875f995 100644
--- a/src/panels/breaks.c
+++ b/src/panels/breaks.c
@@ -343,6 +343,9 @@ static void refresh_breaks_panel_on_bp_added(GBreakGroup *group, GBreakPoint *po
/* Pour le reste... */
refresh_breaks_panel_on_bp_changed(group, point, panel);
+
+ g_object_unref(G_OBJECT(format));
+
#endif
}