summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 2769291..f38cf66 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -79,10 +79,7 @@ struct _GLoadedBinary
DBStorage storages[DBF_COUNT]; /* Lieux d'enregistrement */
GList *collections; /* Ensemble de modifications */
- GBinContent *content; /* Contenu binaire chargé */ //// REMME
-
GExeFormat *format; /* Format du binaire */
- GDbgFormat *debug; /* Informations de débogage */ //// REMME
GArchProcessor *proc; /* Architecture du binaire */
@@ -298,8 +295,6 @@ static void g_loaded_binary_interface_init(GLoadedContentInterface *iface)
static void g_loaded_binary_dispose(GLoadedBinary *binary)
{
- g_object_unref(G_OBJECT(binary->content));
-
if (binary->format != NULL)
g_object_unref(G_OBJECT(binary->format));
@@ -361,8 +356,6 @@ GLoadedBinary *g_loaded_binary_new(GBinContent *content)
log_variadic_message(LMT_PROCESS, _("Opening binary data from '%s'..."),
g_binary_content_describe(content, true));
- result->content = content;
-
/* Format d'exécutable */
status = find_matching_format(content, NULL, &target);
@@ -448,6 +441,7 @@ GLoadedBinary *g_loaded_binary_new_from_xml(xmlXPathContextPtr context, const ch
GBinContent *content; /* Contenu à référencer */
xmlXPathObjectPtr xobject; /* Cible d'une recherche */
unsigned int i; /* Boucle de parcours */
+ bool attached; /* Bilan d'un chargement */
/* Contenus binaires associés */
@@ -462,27 +456,21 @@ GLoadedBinary *g_loaded_binary_new_from_xml(xmlXPathContextPtr context, const ch
free(access);
if (hash == NULL)
- {
- free(content_path);
- return NULL;
- }
+ goto glbnfx_early_error;
content = g_study_project_find_binary_content_by_hash(project, hash);
+
free(hash);
if (content == NULL)
- {
- free(content_path);
- return NULL;
- }
+ goto glbnfx_early_error;
result = g_loaded_binary_new(content);
+ g_object_unref(G_OBJECT(content));
+
if (result == NULL)
- {
- free(content_path);
- return NULL;
- }
+ goto glbnfx_early_error;
asprintf(&access, "%s/DebugInfo", content_path);
@@ -499,25 +487,21 @@ GLoadedBinary *g_loaded_binary_new_from_xml(xmlXPathContextPtr context, const ch
free(access);
if (hash == NULL)
- {
- free(content_path);
goto glbnfx_error;
- }
content = g_study_project_find_binary_content_by_hash(project, hash);
+
free(hash);
if (content == NULL)
- {
- free(content_path);
goto glbnfx_error;
- }
- if (!g_loaded_binary_attach_debug_info(result, content))
- {
- free(content_path);
+ attached = g_loaded_binary_attach_debug_info(result, content);
+
+ g_object_unref(G_OBJECT(content));
+
+ if (!attached)
goto glbnfx_error;
- }
}
@@ -529,14 +513,26 @@ GLoadedBinary *g_loaded_binary_new_from_xml(xmlXPathContextPtr context, const ch
/* Elément divers associés au binaire */
if (!g_loaded_binary_load_storage(result, context, path))
- goto glbnfx_error;
+ goto glbnfx_final_error;
return result;
glbnfx_error:
+ free(content_path);
+
+ glbnfx_final_error:
+
+ g_object_unref(G_OBJECT(result));
+
+ return NULL;
+
+ glbnfx_early_error:
+
g_object_unref(G_OBJECT(result));
+ free(content_path);
+
return NULL;
}