summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/db
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-01-08 23:42:44 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-01-08 23:42:44 (GMT)
commit43f249445c9c69b9eabeea8be08b6b55a474f1fc (patch)
treed2ef7c1c464c13fb3fbd8c44b233b83a12df09a1 /plugins/pychrysalide/analysis/db
parent70dce9d37e6b38c5bee7cfe175dcebd021e3a148 (diff)
Fixed the link between native and Python locations.
Diffstat (limited to 'plugins/pychrysalide/analysis/db')
-rw-r--r--plugins/pychrysalide/analysis/db/items/bookmark.c18
-rw-r--r--plugins/pychrysalide/analysis/db/items/comment.c14
2 files changed, 25 insertions, 7 deletions
diff --git a/plugins/pychrysalide/analysis/db/items/bookmark.c b/plugins/pychrysalide/analysis/db/items/bookmark.c
index 468f38c..547d8f1 100644
--- a/plugins/pychrysalide/analysis/db/items/bookmark.c
+++ b/plugins/pychrysalide/analysis/db/items/bookmark.c
@@ -148,7 +148,7 @@ static PyObject *py_db_bookmark_new(PyTypeObject *type, PyObject *args, PyObject
static int py_db_bookmark_init(PyObject *self, PyObject *args, PyObject *kwds)
{
int result; /* Bilan à renvoyer */
- vmpa2t addr; /* Emplacement ciblé */
+ vmpa2t *addr; /* Emplacement ciblé */
const char *comment; /* Commentaire éventuel associé*/
int ret; /* Bilan de lecture des args. */
PyObject *new_args; /* Nouveaux arguments épurés */
@@ -190,14 +190,24 @@ static int py_db_bookmark_init(PyObject *self, PyObject *args, PyObject *kwds)
Py_DECREF(new_kwds);
Py_DECREF(new_args);
- if (ret == -1) goto exit;
+ if (ret == -1)
+ {
+ clean_vmpa_arg(addr);
+ goto exit;
+ }
/* Eléments de base */
bookmark = G_DB_BOOKMARK(pygobject_get(self));
- status = g_db_bookmark_fill(bookmark, &addr, comment);
- if (!status) goto exit;
+ status = g_db_bookmark_fill(bookmark, addr, comment);
+ if (!status)
+ {
+ clean_vmpa_arg(addr);
+ goto exit;
+ }
+
+ clean_vmpa_arg(addr);
result = 0;
diff --git a/plugins/pychrysalide/analysis/db/items/comment.c b/plugins/pychrysalide/analysis/db/items/comment.c
index 6d05403..6a9f990 100644
--- a/plugins/pychrysalide/analysis/db/items/comment.c
+++ b/plugins/pychrysalide/analysis/db/items/comment.c
@@ -71,7 +71,7 @@ static PyObject *py_db_comment_new(PyTypeObject *type, PyObject *args, PyObject
int repeatable; /* Note une répétition demandée*/
const char *text; /* Eventuel premier commentaire*/
int before; /* Indication sur l'emplacement*/
- vmpa2t addr; /* Emplacement ciblé */
+ vmpa2t *addr; /* Emplacement ciblé */
unsigned long flags; /* Identifiants de ligne visée */
int ret; /* Bilan de lecture des args. */
GDbComment *comment; /* Version GLib du commentaire */
@@ -92,26 +92,34 @@ static PyObject *py_db_comment_new(PyTypeObject *type, PyObject *args, PyObject
if (flags > BLF_ALL)
{
+ clean_vmpa_arg(addr);
+
PyErr_SetString(PyExc_ValueError, _("Invalid flag combination"));
return NULL;
+
}
if ((repeatable == -1 && before == -1) || (repeatable != -1 && before != -1))
{
+ clean_vmpa_arg(addr);
+
PyErr_SetString(PyExc_ValueError, _("repeatable or before has to be defined"));
return NULL;
+
}
/* Construction */
if (repeatable)
- comment = g_db_comment_new_inlined(&addr, flags, repeatable);
+ comment = g_db_comment_new_inlined(addr, flags, repeatable);
else
- comment = g_db_comment_new_area(&addr, flags, text, before);
+ comment = g_db_comment_new_area(addr, flags, text, before);
result = pygobject_new(G_OBJECT(comment));
g_object_unref(comment);
+ clean_vmpa_arg(addr);
+
return result;
}