Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix leaks in gui_helper_3_helper_. #3256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 5 additions & 7 deletions src/nrnpython/nrnpy_hoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2699,18 +2699,16 @@
auto active_obj = nb::steal(nrnpy_ho2po(*hoc_objgetarg(iiarg)));
PyTuple_SetItem(args.ptr(), iarg + 3, active_obj.release().ptr());
} else if (hoc_is_pdouble_arg(iiarg)) {
PyHocObject* ptr_nrn = (PyHocObject*) hocobj_new(hocobject_type, 0, 0);
auto py_ptr = nb::steal(hocobj_new(hocobject_type, 0, 0));
PyHocObject* ptr_nrn = (PyHocObject*) py_ptr.ptr();

Check warning on line 2703 in src/nrnpython/nrnpy_hoc.cpp

View check run for this annotation

Codecov / codecov/patch

src/nrnpython/nrnpy_hoc.cpp#L2702-L2703

Added lines #L2702 - L2703 were not covered by tests
ptr_nrn->type_ = PyHoc::HocScalarPtr;
ptr_nrn->u.px_ = hoc_hgetarg<double>(iiarg);
PyObject* py_ptr = (PyObject*) ptr_nrn;
Py_INCREF(py_ptr);
PyTuple_SetItem(args.ptr(), iarg + 3, py_ptr);
PyTuple_SetItem(args.ptr(), iarg + 3, py_ptr.release().ptr());

Check warning on line 2706 in src/nrnpython/nrnpy_hoc.cpp

View check run for this annotation

Codecov / codecov/patch

src/nrnpython/nrnpy_hoc.cpp#L2706

Added line #L2706 was not covered by tests
} else if (hoc_is_str_arg(iiarg)) {
if (handle_strptr > 0) {
char** str_arg = hoc_pgargstr(iiarg);
PyObject* py_ptr = cpp2refstr(str_arg);
Py_INCREF(py_ptr);
PyTuple_SetItem(args.ptr(), iarg + 3, py_ptr);
auto py_ptr = nb::steal(cpp2refstr(str_arg));
PyTuple_SetItem(args.ptr(), iarg + 3, py_ptr.release().ptr());

Check warning on line 2711 in src/nrnpython/nrnpy_hoc.cpp

View check run for this annotation

Codecov / codecov/patch

src/nrnpython/nrnpy_hoc.cpp#L2710-L2711

Added lines #L2710 - L2711 were not covered by tests
} else {
auto py_str = nb::steal(PyString_FromString(gargstr(iiarg)));
PyTuple_SetItem(args.ptr(), iarg + 3, py_str.release().ptr());
Expand Down
Loading