Skip to content
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 some UBs and memory leaks #1757

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Release/src/http/client/http_client_winhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ class winhttp_request_context final : public request_context
, m_started(false)
, m_done(false)
, m_chunked(false)
, m_chunk_bytes(0)
{
}

Expand Down Expand Up @@ -679,6 +680,7 @@ class winhttp_request_context final : public request_context
winhttp_request_context(const std::shared_ptr<_http_client_communicator>& client, const http_request& request)
: request_context(client, request)
, m_request_handle(nullptr)
, m_request_handle_context(nullptr)
, m_proxy_authentication_tried(false)
, m_server_authentication_tried(false)
, m_remaining_redirects(0)
Expand Down
2 changes: 1 addition & 1 deletion Release/src/uri/uri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ uri::uri(const details::uri_components& components) : m_components(components)
{
m_uri = m_components.join();

if (!uri::validate(m_uri.c_str()))
if (!uri::validate(m_uri))
{
throw uri_exception("provided uri is invalid: " + utility::conversions::to_utf8string(m_uri));
}
Expand Down
2 changes: 2 additions & 0 deletions Release/src/utilities/asyncrt_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ scoped_c_thread_locale::xplat_locale scoped_c_thread_locale::c_locale()
*clocale = _create_locale(LC_ALL, "C");
if (clocale == nullptr || *clocale == nullptr)
{
delete clocale;
throw std::runtime_error("Unable to create 'C' locale.");
}
auto deleter = [](scoped_c_thread_locale::xplat_locale* clocale) {
Expand All @@ -127,6 +128,7 @@ scoped_c_thread_locale::xplat_locale scoped_c_thread_locale::c_locale()
*clocale = newlocale(LC_ALL_MASK, "C", nullptr);
if (clocale == nullptr || *clocale == nullptr)
{
delete clocale;
throw std::runtime_error("Unable to create 'C' locale.");
}
auto deleter = [](scoped_c_thread_locale::xplat_locale *clocale)
Expand Down