Skip to content

Commit

Permalink
fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
lehner committed Sep 29, 2023
1 parent 5bf0574 commit 5da478a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/cgpt/lib/lattice/implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class cgpt_Lattice : public cgpt_Lattice_base {
}

virtual PyObject* to_decl() {
return PyTuple_Pack(3,PyLong_FromVoidPtr(this),
return Py_BuildValue("(NNN)",PyLong_FromVoidPtr(this),
PyUnicode_FromString(get_otype(l).c_str()),
PyUnicode_FromString(get_prec(l).c_str()));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cgpt/lib/transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ EXPORT(lattice_inner_product_norm2,{

a->inner_product_norm2(ip,a2,b);

return PyTuple_Pack(2,
return Py_BuildValue("(NN)",
PyComplex_FromDoubles(ip.real(),ip.imag()),
PyFloat_FromDouble(a2));
});
Expand Down
2 changes: 1 addition & 1 deletion lib/cgpt/lib/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ EXPORT(util_sha256,{
uint32_t sha256[8];
cgpt_sha256(sha256,data,len);

return PyTuple_Pack(8,
return Py_BuildValue("(NNNNNNNN)",
PyLong_FromLong(sha256[0]),
PyLong_FromLong(sha256[1]),
PyLong_FromLong(sha256[2]),
Expand Down

0 comments on commit 5da478a

Please sign in to comment.