Skip to content

Commit

Permalink
Fix tls_ctx memleak in s3 client creation
Browse files Browse the repository at this point in the history
Reproduction scenario:

```
try(var tlsc = new TlsContext(); var c = new S3Client(new S3ClientOptions()
                    .withRegion("eu-west-1")
                    .withClientBootstrap(ClientBootstrap.getOrCreateStaticDefault())
                    .withTlsContext(tlsc)
            )) {
            }
```

--> this code will quickly go OOM without the fix in this commit
  • Loading branch information
praetp committed Aug 20, 2024
1 parent 9861cd7 commit 0cf368b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/native/s3_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,9 @@ JNIEXPORT jlong JNICALL Java_software_amazon_awssdk_crt_s3_S3Client_s3ClientNew(
env, &proxy_options, jni_proxy_host, jni_proxy_authorization_username, jni_proxy_authorization_password);

aws_mem_release(aws_jni_get_allocator(), s3_tcp_keep_alive_options);

if (!tls_options) {
aws_tls_connection_options_clean_up(tls_options);
}
return (jlong)client;
}

Expand Down

0 comments on commit 0cf368b

Please sign in to comment.