Fix memory leak in ProcessLauncher::LaunchProcess (#2823)

Inner scope numEnvironmentVars was shadowing the outer scope, and prevented env variable memory from being freed.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
monroegm-disable-blank-issue-2
Artur K 4 years ago committed by GitHub
parent 08c85a40bc
commit 4d82d9625c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -269,7 +269,7 @@ namespace AzFramework
int numEnvironmentVars = 0;
if (processLaunchInfo.m_environmentVariables)
{
const int numEnvironmentVars = processLaunchInfo.m_environmentVariables->size();
numEnvironmentVars = processLaunchInfo.m_environmentVariables->size();
// Adding one more as exec expects the array to have a nullptr as the last element
environmentVariables = new char*[numEnvironmentVars + 1];
for (int i = 0; i < numEnvironmentVars; i++)

Loading…
Cancel
Save