Skip to content

Commit

Permalink
Merge pull request #96 from purva-vasudeo/master
Browse files Browse the repository at this point in the history
Clean old handle before creating a new one
  • Loading branch information
purva-vasudeo committed Mar 4, 2021
2 parents 4fd52bd + 247d1e4 commit 7e4773a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/iisnode/cprotocolbridge.cpp
Expand Up @@ -626,6 +626,12 @@ void WINAPI CProtocolBridge::CreateNamedPipeConnection(DWORD error, DWORD bytesT

if (INVALID_HANDLE_VALUE == pipe)
{
// Clean up old pipe handle, otherwise there will be a handle leak
HANDLE oldPipe = ctx->GetPipe();
if (oldPipe != NULL && oldPipe != INVALID_HANDLE_VALUE) {
CloseHandle(oldPipe);
}

ErrorIf(INVALID_HANDLE_VALUE == (pipe = CreateFile(
ctx->GetNodeProcess()->GetNamedPipeName(),
GENERIC_READ | GENERIC_WRITE,
Expand Down

0 comments on commit 7e4773a

Please sign in to comment.