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

jq_fuzz_execute: fix memory leak #2960

Merged
merged 3 commits into from
Dec 3, 2023

Conversation

DavidKorczynski
Copy link
Contributor

Signed-off-by: David Korczynski <[email protected]>
// Do not free "input" as this is handled by jq_teardown.
else {
// Only free if input as invalid as otherwise jq_teardown
// frees it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if understand it correctly: jq_parse will always return something allocated. If valid the input argument will end up on the stack by jq_start and freed during teardown. If invalid it needs to be freed explicitly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's how I understand it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is invalid"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is invalid"?

Ah yes, good catch. Fixed.

tests/jq_fuzz_execute.cpp Outdated Show resolved Hide resolved
Signed-off-by: David Korczynski <[email protected]>
Copy link
Member

@wader wader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but maybe wait for one more approve

Signed-off-by: David Korczynski <[email protected]>
@emanuele6 emanuele6 merged commit 693a726 into jqlang:master Dec 3, 2023
28 checks passed
@emanuele6
Copy link
Member

Thank you!

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

Successfully merging this pull request may close these issues.

3 participants