mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-04-08 19:35:37 +02:00
Merge pull request #22 from noshbar/L1
Fix potential memory leak in win32/console.c
This commit is contained in:
commit
9fa44f0777
@ -1627,7 +1627,13 @@ SCREEN_HANDLE ConSaveScreenHandle( SCREEN_HANDLE hScreen )
|
||||
}
|
||||
|
||||
if ( !pScreenRec->pScreenBuf )
|
||||
{
|
||||
// if we allocated a screen within this scope, free it before returning
|
||||
if ( pScreenRec != (PSCREEN_RECORD)hScreen ) {
|
||||
free(pScreenRec);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = ReadConsoleOutput( hConsole, // handle of a console screen buffer
|
||||
(PCHAR_INFO)(pScreenRec->pScreenBuf), // address of buffer that receives data
|
||||
|
Loading…
x
Reference in New Issue
Block a user