summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/analysis')
-rw-r--r--plugins/pychrysa/analysis/db/items/comment.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/pychrysa/analysis/db/items/comment.c b/plugins/pychrysa/analysis/db/items/comment.c
index 4a90f09..1062cc9 100644
--- a/plugins/pychrysa/analysis/db/items/comment.c
+++ b/plugins/pychrysa/analysis/db/items/comment.c
@@ -25,6 +25,7 @@
#include "comment.h"
+#include <malloc.h>
#include <pygobject.h>
@@ -108,13 +109,25 @@ static PyObject *py_db_comment_new(PyTypeObject *type, PyObject *args, PyObject
static PyObject *py_db_comment_get_text(PyObject *self, void *closure)
{
+ PyObject *result; /* Résultat à retourner */
GDbComment *comment; /* Commentaire à consulter */
- const char *content; /* Contenu textuel associé */
+ char *text; /* Contenu textuel associé */
comment = G_DB_COMMENT(pygobject_get(self));
- content = g_db_comment_get_text(comment);
+ text = g_db_comment_get_text(comment);
- return PyUnicode_FromString(content);
+ if (text == NULL)
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+ else
+ {
+ result = PyUnicode_FromString(text);
+ free(text);
+ }
+
+ return result;
}