summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-21 18:39:40 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-21 18:39:40 (GMT)
commit7c04cf1a2dcc9e04ce8f280f399d6904053e89d9 (patch)
tree913d6685f00328ea7fdd9db756f3354c6893b265
parentfe679c19bb156abb348184b1dd222adb61164c23 (diff)
Handled cases when the required processor is not found.
-rw-r--r--plugins/pychrysalide/analysis/binary.c13
-rw-r--r--src/analysis/binary.c7
2 files changed, 14 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/binary.c b/plugins/pychrysalide/analysis/binary.c
index 0fc9f38..c173605 100644
--- a/plugins/pychrysalide/analysis/binary.c
+++ b/plugins/pychrysalide/analysis/binary.c
@@ -180,9 +180,16 @@ static PyObject *py_loaded_binary_get_processor(PyObject *self, void *closure)
binary = G_LOADED_BINARY(pygobject_get(self));
proc = g_loaded_binary_get_processor(binary);
- result = pygobject_new(G_OBJECT(proc));
-
- g_object_unref(G_OBJECT(proc));
+ if (proc != NULL)
+ {
+ result = pygobject_new(G_OBJECT(proc));
+ g_object_unref(G_OBJECT(proc));
+ }
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
return result;
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index c38a725..8964973 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -1272,7 +1272,8 @@ GArchProcessor *g_loaded_binary_get_processor(const GLoadedBinary *binary)
result = binary->proc;
- g_object_ref(G_OBJECT(result));
+ if (result != NULL)
+ g_object_ref(G_OBJECT(result));
return result;
@@ -1727,6 +1728,7 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, wgroup_id_t gid, GtkS
if (desc == NULL)
{
log_simple_message(LMT_INFO, _("Unknown architecture"));
+ result = false;
goto glba_exit;
}
else
@@ -1737,6 +1739,7 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, wgroup_id_t gid, GtkS
if (binary->proc == NULL)
{
log_simple_message(LMT_ERROR, _("Unable to load the required processor"));
+ result = false;
goto glba_exit;
}
@@ -1768,8 +1771,6 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, wgroup_id_t gid, GtkS
}
- result = true;
-
glba_exit:
return result;