Fix small "Use after free" bug (#2409)

Co-authored-by: Jørgen Lind <jorgen.lind@bluware.com>
This commit is contained in:
Jørgen Lind 2021-06-09 09:42:40 +02:00 committed by GitHub
parent a3be057f59
commit b2a21c665d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,10 +67,11 @@ namespace Azure { namespace Core {
BIO_flush(bio);
BUF_MEM* bufferPtr;
BIO_get_mem_ptr(bio, &bufferPtr);
std::string toReturn(bufferPtr->data, bufferPtr->length);
BIO_set_close(bio, BIO_NOCLOSE);
BIO_free_all(bio);
return std::string(bufferPtr->data, bufferPtr->length);
return toReturn;
}
std::vector<uint8_t> Convert::Base64Decode(const std::string& text)