Skip to content

Commit

Permalink
Fix ref-counting issue in python wrapper. Fixes #171
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Krogius committed Sep 16, 2021
1 parent c515a79 commit 80bf732
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apriltag_pywrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static PyObject* apriltag_detect(apriltag_py_t* self,
PyErr_Format(PyExc_RuntimeError, "Error creating output tuple of size %d", N);
goto done;
}

for (int i=0; i < N; i++)
{
xy_c = (PyArrayObject*)PyArray_SimpleNew(1, ((npy_intp[]){2}), NPY_FLOAT64);
Expand Down Expand Up @@ -264,7 +264,7 @@ static PyObject* apriltag_detect(apriltag_py_t* self,
}

PyTuple_SET_ITEM(detections_tuple, i,
Py_BuildValue("{s:i,s:f,s:i,s:O,s:O}",
Py_BuildValue("{s:i,s:f,s:i,s:N,s:N}",
"hamming", det->hamming,
"margin", det->decision_margin,
"id", det->id,
Expand All @@ -278,7 +278,7 @@ static PyObject* apriltag_detect(apriltag_py_t* self,
result = detections_tuple;
detections_tuple = NULL;

done:
done:
Py_XDECREF(xy_c);
Py_XDECREF(xy_lb_rb_rt_lt);
Py_XDECREF(image);
Expand Down

0 comments on commit 80bf732

Please sign in to comment.