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 leak of resources when unable to flush binary writer #302

Merged

Conversation

nirosys
Copy link
Contributor

@nirosys nirosys commented Jul 9, 2022

Issue #, if available: None

Description of changes:
Prior to this commit when a binary writer was closed,
but could not be flushed, the _ion_writer_close_helper
function would skip _ion_writer_binary_close, which
resulted in the binary writer's _value_stream being
leaked.

This commit updates the close functions for both binary
and text formats to include a BOOL to communicate if
we want to flush or not. _ion_writer_close_helper was then
updated to track if we are able to flush and provide
that info to the format writer's close, so we can ensure
all resources are cleaned up.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Prior to this commit when a binary writer was closed,
but could not be flushed, the _ion_writer_close_helper
function would skip _ion_writer_binary_close, which
resulted in the binary writer's _value_stream being
leaked.

This commit updates the close functions for both binary
and text formats to include a BOOL to communicate if
we want to flush or not. _ion_writer_close_helper was then
updated to track if we are able to flush and provide
that info to the format writer's close, so we can ensure
all resources are cleaned up.
@nirosys nirosys marked this pull request as ready for review July 11, 2022 18:53
Copy link
Contributor

@tgregg tgregg left a comment

Choose a reason for hiding this comment

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

Looks good

@nirosys nirosys merged commit 6b4936a into amazon-ion:master Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants