aws / aws-sdk-cpp

AWS SDK for C++
Apache License 2.0
1.96k stars 1.05k forks source link

Fix rare memory leak in XML Error copy-assignment #2905

Closed SergeyRyabinin closed 6 months ago

SergeyRyabinin commented 6 months ago

Issue #, if available: rare memory leak in such conditions:

    AWSError<CoreErrors> error = awsErrorMarshaller.Marshall(*BuildHttpXmlResponse("IncompleteSignatureException", message, requestId, IllFormed));
    AWSError<CoreErrors> emptyError;
    error = emptyError; // i.e. assign empty AWSError to a non-empty XML AWSError

Description of changes: add Aws::Delete to

XmlDocument& XmlDocument::operator=(const XmlDocument& other)
<...>
Aws::Delete(m_doc);

Check all that applies:

Check which platforms you have built SDK on to verify the correctness of this PR.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.