-
Notifications
You must be signed in to change notification settings - Fork 61
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 memory leaks in Windows TLS code #652
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TingDaoK
reviewed
Jul 3, 2024
…to call FreeContextBuffer()
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #652 +/- ##
==========================================
+ Coverage 80.12% 80.22% +0.10%
==========================================
Files 28 28
Lines 5967 5957 -10
==========================================
- Hits 4781 4779 -2
+ Misses 1186 1178 -8 ☔ View full report in Codecov by Sentry. |
TingDaoK
approved these changes
Jul 8, 2024
graebm
added a commit
to awslabs/aws-crt-cpp
that referenced
this pull request
Jul 11, 2024
Update to latest submodules: ``` aws-c-cal v0.7.0 -> v0.7.1 aws-c-io v0.14.9 -> v0.14.11 aws-c-http v0.8.2 -> v0.8.3 aws-c-s3 v0.5.10 -> v0.6.1 aws-lc v1.30.1 -> v1.31.0 s2n v1.4.16 -> v1.4.17 ``` Fix comes from here: awslabs/aws-c-io#652
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
A C++ SDK user found a memory leak in the Windows TLS channel-handler code and submitted the following PR: #651
In evaluating this 2-line fix, I noticed that it sat in the middle of some (preexisting) sloppy error-handling.
Description of changes:
FreeContextBuffer()
.FreeContextBuffer()
after calling toAcceptSecurityContext()
/InitializeSecurityContextA()
. Previously we'd only free the buffer in certain circumstances, and were probably leaking.aws_io_message
. Officially declare that message allocations can't fail.NULL
. They deal with OOM by immediately terminating the program. This was done because error-handling code for allocation failure makes everything so much more complex, and it's seldom tested. We tried for years to handle it. It's not worth the effort.aws_io_message
after checking its capacityAWS_ASSERT()
about buffers being large enough withAWS_FATAL_ASSERT()
. Similarly, add anAWS_FATAL_ASSERT()
in one place that never checked or asserted before doing the copy.Co-authored-by: @normanade
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.