[Utils] Fix memory-leaking and corrupting functions
This commit is contained in:
parent
617b549032
commit
a40780e567
@ -207,23 +207,5 @@ namespace Utils
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Generates a UUID and returns the string representation of it
|
||||
std::string GenerateUUIDString()
|
||||
{
|
||||
// Generate UUID data
|
||||
UUID uuid;
|
||||
if (!UuidCreate(&uuid))
|
||||
{
|
||||
// Convert to string representation
|
||||
char* strdata = nullptr;
|
||||
if (!UuidToStringA(&uuid, reinterpret_cast<RPC_CSTR*>(&strdata)))
|
||||
{
|
||||
return std::string(strdata);
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,5 @@ namespace Utils
|
||||
std::string EncodeBase64(const std::string& input);
|
||||
|
||||
std::string EncodeBase128(const std::string& input);
|
||||
|
||||
std::string GenerateUUIDString();
|
||||
}
|
||||
}
|
||||
|
@ -57,11 +57,12 @@ namespace Utils
|
||||
}
|
||||
|
||||
PARSEDURLA pURL;
|
||||
ZeroMemory(&pURL, sizeof(pURL));
|
||||
pURL.cbSize = sizeof(pURL);
|
||||
ParseURLA(_url.data(), &pURL);
|
||||
|
||||
// Parse protocol
|
||||
if (pURL.cchProtocol && pURL.cchProtocol != 0xCCCCCCCC && pURL.pszProtocol)
|
||||
if (pURL.cchProtocol && pURL.pszProtocol)
|
||||
{
|
||||
for (UINT i = 0; i < pURL.cchProtocol; ++i)
|
||||
{
|
||||
@ -77,7 +78,7 @@ namespace Utils
|
||||
// Parse suffix
|
||||
std::string server;
|
||||
|
||||
if (pURL.cchSuffix && pURL.cchSuffix != 0xCCCCCCCC && pURL.pszSuffix)
|
||||
if (pURL.cchSuffix && pURL.pszSuffix)
|
||||
{
|
||||
server.append(pURL.pszSuffix, pURL.cchSuffix);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user