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

[CP #1754 > support/v5.13] Fix memory leaks in Python wrapper by adding missing Py_DECREF. #1758

Merged
merged 1 commit into from
Oct 2, 2024
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: 4 additions & 2 deletions lang/python/core/src/ecal_wrap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,8 @@ PyObject* mon_monitoring(PyObject* /*self*/, PyObject* /*args*/)
}
}

return(Py_BuildValue("iO", 0, retDict));
auto* retVal = Py_BuildValue("iO", 0, retDict); Py_DECREF(retDict);
return(retVal);
}

/****************************************/
Expand Down Expand Up @@ -1566,7 +1567,8 @@ PyObject* mon_logging(PyObject* /*self*/, PyObject* /*args*/)
}
}

return(Py_BuildValue("iO", 0, retList));
auto* retVal = Py_BuildValue("iO", 0, retList); Py_DECREF(retList);
return(retVal);
}

/****************************************/
Expand Down
4 changes: 2 additions & 2 deletions lang/python/ecalhdf5/src/ecalhdf5_wrap.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -178,7 +178,7 @@ static PyObject* Meas_GetChannelNames(Meas *self, PyObject* /*args*/)
for (const auto& channel : channel_names)
{
PyObject* ch = Py_BuildValue("s", channel.c_str());
PyList_Append(channels, ch);
PyList_Append(channels, ch); Py_DECREF(ch);
}

return channels;
Expand Down
Loading