Fix leak querying WSL versioninfo
@@ -111,8 +111,11 @@ BOOLEAN PhGetWslDistributionFromPath(
}
if (LxssDistroPath)
- {
*LxssDistroPath = lxssDistroPath;
+ else
+ {
+ if (lxssDistroPath)
+ PhDereferenceObject(lxssDistroPath);
}
if (LxssFileName)
@@ -128,14 +131,21 @@ BOOLEAN PhGetWslDistributionFromPath(
*LxssFileName = lxssFileName;
}
+ else
+ {
+ if (lxssFileName)
+ PhDereferenceObject(lxssFileName);
+ }
if (LxssDistroName)
- {
- if (lxssDistributionName)
{
*LxssDistroName = lxssDistributionName;
return TRUE;
}
+ else
+ {
+ if (lxssDistributionName)
+ PhDereferenceObject(lxssDistributionName);
}
return FALSE;
