Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
History
-------

1.5.1 (2019-09-27)
++++++++++++++++++

* Fix a possible segfault due to not correctly incrementing the reference
on a returned object.

1.5.0 (2019-09-27)
++++++++++++++++++

Expand Down
6 changes: 5 additions & 1 deletion extension/maxminddb.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ static PyObject *Reader_get_with_prefix_len(PyObject *self, PyObject *args) {
return NULL;
}

return PyTuple_Pack(2, record, PyLong_FromLong(prefix_len));
PyObject *tuple = Py_BuildValue("(Oi)", record, prefix_len);
Py_DECREF(record);

return tuple;
}

static int get_record(PyObject *self, PyObject *args, PyObject **record) {
Expand Down Expand Up @@ -178,6 +181,7 @@ static int get_record(PyObject *self, PyObject *args, PyObject **record) {
}

if (!result.found_entry) {
Py_INCREF(Py_None);
*record = Py_None;
return prefix_len;
}
Expand Down