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

memory leak in permutate.hpp #3014

Closed
qingkaishi opened this issue Oct 23, 2019 · 1 comment · Fixed by #3015
Closed

memory leak in permutate.hpp #3014

qingkaishi opened this issue Oct 23, 2019 · 1 comment · Fixed by #3015

Comments

@qingkaishi
Copy link

template <class T>
std::vector<std::vector<T>> permutate(
const std::vector<std::vector<T>>& in)
{
size_t L = in.size();
size_t n = 0;
size_t* state = new size_t[L + 1];
std::vector<std::vector<T>> out;
// First initialize all states for every permutation group
for (size_t i = 0; i < L; i += 1) {
if (in[i].size() == 0) return {};
state[i] = in[i].size() - 1;
}
while (true) {

As shown above, memory allocated at Line 27 is not released at Line 32 but the function returns.

mgreter added a commit to mgreter/libsass that referenced this issue Oct 23, 2019
mgreter added a commit to mgreter/libsass that referenced this issue Oct 23, 2019
@mgreter
Copy link
Contributor

mgreter commented Oct 23, 2019

Thanks, good catch. Addressed with #3015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants