summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c21
-rw-r--r--src/analysis/loaded.c2
-rw-r--r--src/analysis/loading.c4
-rw-r--r--src/analysis/project.c8
-rw-r--r--src/analysis/type.c3
-rw-r--r--src/analysis/variable.c57
6 files changed, 73 insertions, 22 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index f03ad17..8946311 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -82,7 +82,6 @@ struct _GLoadedBinary
GExeFormat *format; /* Format du binaire */
GArchProcessor *proc; /* Architecture du binaire */
-
GBufferCache *disass_cache; /* Instructions lisibles */
//GCodeBuffer **dec_buffers; /* Sources sous forme de texte */
size_t decbuf_count; /* Taille des tableaux */
@@ -308,18 +307,18 @@ static void g_loaded_binary_dispose(GLoadedBinary *binary)
{
BinaryView i; /* Boucle de parcours */
- if (binary->format != NULL)
- g_object_unref(G_OBJECT(binary->format));
-
- if (binary->proc != NULL)
- g_object_unref(G_OBJECT(binary->proc));
+ g_clear_object(&binary->local);
+ g_clear_object(&binary->remote);
- /* TODO... */
+ delete_collections_list(&binary->collections);
+ g_clear_object(&binary->format);
+ g_clear_object(&binary->proc);
+ g_clear_object(&binary->disass_cache);
for (i = 0; i < BVW_COUNT; i++)
- g_object_unref(G_OBJECT(binary->options[i]));
+ g_clear_object(&binary->options[i]);
G_OBJECT_CLASS(g_loaded_binary_parent_class)->dispose(G_OBJECT(binary));
@@ -342,7 +341,7 @@ static void g_loaded_binary_finalize(GLoadedBinary *binary)
{
free(binary->username);
- /* TODO... */
+ free(binary->remote_host);
G_OBJECT_CLASS(g_loaded_binary_parent_class)->finalize(G_OBJECT(binary));
@@ -1063,15 +1062,11 @@ GDbCollection *g_loaded_binary_find_collection(const GLoadedBinary *binary, DBFe
{
GDbCollection *result; /* Collection à retourner */
- /* TODO : lock */
-
result = find_collection_in_list(binary->collections, feature);
if (result != NULL)
g_object_ref(G_OBJECT(result));
- /* TODO : unlock */
-
return result;
}
diff --git a/src/analysis/loaded.c b/src/analysis/loaded.c
index 8c45ef4..d148366 100644
--- a/src/analysis/loaded.c
+++ b/src/analysis/loaded.c
@@ -615,7 +615,7 @@ static void g_loaded_analysis_init(GLoadedAnalysis *analysis)
static void g_loaded_analysis_dispose(GLoadedAnalysis *analysis)
{
- g_object_unref(G_OBJECT(analysis->content));
+ g_clear_object(&analysis->content);
G_OBJECT_CLASS(g_loaded_analysis_parent_class)->dispose(G_OBJECT(analysis));
diff --git a/src/analysis/loading.c b/src/analysis/loading.c
index 0afc60f..0ded268 100644
--- a/src/analysis/loading.c
+++ b/src/analysis/loading.c
@@ -356,7 +356,7 @@ static void g_exploring_work_init(GExploringWork *work)
static void g_exploring_work_dispose(GExploringWork *work)
{
- g_object_unref(G_OBJECT(work->content));
+ g_clear_object(&work->content);
G_OBJECT_CLASS(g_exploring_work_parent_class)->dispose(G_OBJECT(work));
@@ -1071,7 +1071,7 @@ static void g_resolving_work_init(GResolvingWork *work)
static void g_resolving_work_dispose(GResolvingWork *work)
{
- g_object_unref(G_OBJECT(work->content));
+ g_clear_object(&work->content);
G_OBJECT_CLASS(g_resolving_work_parent_class)->dispose(G_OBJECT(work));
diff --git a/src/analysis/project.c b/src/analysis/project.c
index 4399fc4..e01a126 100644
--- a/src/analysis/project.c
+++ b/src/analysis/project.c
@@ -260,10 +260,7 @@ static void g_study_project_dispose(GStudyProject *project)
g_study_project_lock_contents(project);
for (i = 0; i < project->count; i++)
- g_object_unref(G_OBJECT(project->contents[i]));
-
- if (project->contents != NULL)
- free(project->contents);
+ g_clear_object(&project->contents[i]);
g_study_project_unlock_contents(project);
@@ -291,6 +288,9 @@ static void g_study_project_finalize(GStudyProject *project)
if (project->filename != NULL)
free(project->filename);
+ if (project->contents != NULL)
+ free(project->contents);
+
G_OBJECT_CLASS(g_study_project_parent_class)->finalize(G_OBJECT(project));
}
diff --git a/src/analysis/type.c b/src/analysis/type.c
index d0ab4f5..497ef5e 100644
--- a/src/analysis/type.c
+++ b/src/analysis/type.c
@@ -109,8 +109,7 @@ static void g_data_type_init(GDataType *type)
static void g_data_type_dispose(GDataType *type)
{
- if (type->namespace != NULL)
- g_object_unref(G_OBJECT(type->namespace));
+ g_clear_object(&type->namespace);
G_OBJECT_CLASS(g_data_type_parent_class)->dispose(G_OBJECT(type));
diff --git a/src/analysis/variable.c b/src/analysis/variable.c
index 9fb2e81..a2a8275 100644
--- a/src/analysis/variable.c
+++ b/src/analysis/variable.c
@@ -63,6 +63,12 @@ static void g_binary_variable_class_init(GBinVariableClass *);
/* Initialise l'instande d'une variable. */
static void g_binary_variable_init(GBinVariable *);
+/* Supprime toutes les références externes. */
+static void g_binary_variable_dispose(GBinVariable *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_binary_variable_finalize(GBinVariable *);
+
/* -------------------- BASE DE VARIABLES OU VARIABLES INCONNUES -------------------- */
@@ -117,6 +123,12 @@ G_DEFINE_TYPE(GBinVariable, g_binary_variable, G_TYPE_OBJECT);
static void g_binary_variable_class_init(GBinVariableClass *klass)
{
+ GObjectClass *object; /* Autre version de la classe */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_binary_variable_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_binary_variable_finalize;
}
@@ -141,6 +153,51 @@ static void g_binary_variable_init(GBinVariable *var)
/******************************************************************************
* *
+* Paramètres : var = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_binary_variable_dispose(GBinVariable *var)
+{
+ g_clear_object(&var->type);
+
+ g_clear_object(&var->owner);
+
+ G_OBJECT_CLASS(g_binary_variable_parent_class)->dispose(G_OBJECT(var));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : var = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_binary_variable_finalize(GBinVariable *var)
+{
+ if (var->name != NULL)
+ free(var->name);
+
+ G_OBJECT_CLASS(g_binary_variable_parent_class)->finalize(G_OBJECT(var));
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : type = type de la variable à mettre en place. *
* *
* Description : Crée une représentation de variable de type donné. *