aws/aws-sdk-cpp

S3Client Uploading Leaks Memory on Windows caused by InitializeSecurityContext misuse

Closed this issue · 4 comments

Describe the bug

Aws::S3::S3Client::PutObject leaks memory on Windows. Static funtion s_handler_shutdown in crt/aws-crt-cpp/crt/aws-c-io/source/windows/secure_channel_tls_handler.c is called during uploading, downloading, listing, deleting, any move related to a network request. However, after calling InitializeSecurityContext, current version of code has failed to call the corresponding memory release function FreeContextBuffer.

Expected Behavior

Upload, download, list, delete files normally and don't leak memory.

Current Behavior

Memory usage increases by 200KiB per 1k call.

Reproduction Steps

Call Aws::S3::S3Client::PutObject 1k times.

Possible Solution

In crt/aws-crt-cpp/crt/aws-c-io/source/windows/secure_channel_tls_handler.c, fix the static function s_handler_shutdown by adding FreeContextBuffer correctly.

Additional Information/Context

No response

AWS CPP SDK version used

1.11.314

Compiler and Version used

Visual Studio 2022

Operating System and version

Windows 10

Thanks for opening this PR. We are currently reviewing it.

Merged: awslabs/aws-c-io#652
Please wait for the release to get published and let us know if you have any other issues while using this sdk.

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.