szaszm commented on a change in pull request #801:
URL: https://github.com/apache/nifi-minifi-cpp/pull/801#discussion_r432550851
##########
File path: libminifi/src/utils/OsUtils.cpp
##########
@@ -78,6 +81,8 @@ std::string OsUtils::userIdToUsername(const std::string &uid)
{
// First call to LookupAccountSid to get the buffer sizes.
PSID pSidOwner = NULL;
if (ConvertStringSidToSidA(name.c_str(), &pSidOwner)) {
+ const utils::ScopeGuard guard_pSidOwner([pSidOwner]() {
LocalFree(pSidOwner); });
Review comment:
MSDN doesn't seem to guarantee that `LocalFree` only has to be called
when the function call is successful. I suggest moving the scope guard outside
with a null check.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]