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

Fixes a memory leak issue in reader API. #261

Merged
merged 2 commits into from
Dec 2, 2021

Conversation

cheqianh
Copy link
Contributor

@cheqianh cheqianh commented Dec 1, 2021

This issue was mentioned in amazon-ion/ion-python#172 (comment)

Owner should be released when the method fails.

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

@cheqianh cheqianh requested a review from tgregg December 1, 2021 23:16
@cheqianh cheqianh marked this pull request as draft December 1, 2021 23:21
@cheqianh
Copy link
Contributor Author

cheqianh commented Dec 1, 2021

Change it back to draft mode as it fails GH Actions.

@@ -1917,7 +1917,12 @@ iERR _ion_reader_process_possible_symbol_table(ION_READER *preader, BOOL *is_sym
preader->_local_symtab_pool = owner;
preader->_current_symtab = local;
}
iRETURN;
SUCCEED();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is how SUCCEED is defined:

#define SUCCEED()        { err = IERR_OK; goto fail; }

So this line will jump to the fail label on the next line and free the owner, if any. It looks like that's not actually what we want; in the successful case we don't want to free the owner. This line should be replaced by return IERR_OK;

I think this is why the tests are failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it thanks. Change it to return IERR_OK works.

@cheqianh cheqianh marked this pull request as ready for review December 2, 2021 00:01
@cheqianh cheqianh merged commit b1d9494 into amazon-ion:master Dec 2, 2021
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