summaryrefslogtreecommitdiff
path: root/plugins/pychrysa
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa')
-rw-r--r--plugins/pychrysa/analysis/contents/file.c4
-rw-r--r--plugins/pychrysa/format/elf/elf.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/plugins/pychrysa/analysis/contents/file.c b/plugins/pychrysa/analysis/contents/file.c
index d356197..897561e 100644
--- a/plugins/pychrysa/analysis/contents/file.c
+++ b/plugins/pychrysa/analysis/contents/file.c
@@ -64,7 +64,9 @@ static PyObject *py_file_content_new(PyTypeObject *type, PyObject *args, PyObjec
content = g_file_content_new(filename);
result = pygobject_new(G_OBJECT(content));
- g_object_unref(content);
+
+ if (content != NULL)
+ g_object_unref(content);
return result;
diff --git a/plugins/pychrysa/format/elf/elf.c b/plugins/pychrysa/format/elf/elf.c
index 07e5130..72a9647 100644
--- a/plugins/pychrysa/format/elf/elf.c
+++ b/plugins/pychrysa/format/elf/elf.c
@@ -28,6 +28,9 @@
#include <pygobject.h>
+#include <i18n.h>
+
+
#include <format/elf/elf.h>
@@ -67,7 +70,11 @@ static PyObject *py_elf_format_new(PyTypeObject *type, PyObject *args, PyObject
if (!ret) return NULL;
ret = PyObject_IsInstance(content_obj, (PyObject *)get_python_binary_content_type());
- if (!ret) return NULL;
+ if (!ret)
+ {
+ PyErr_SetString(PyExc_TypeError, _("The argument must be an instance of BinContent."));
+ return NULL;
+ }
content = G_BIN_CONTENT(pygobject_get(content_obj));
format = g_elf_format_new(content, NULL);