Subject: | Memory leak in _SetStdHandle() in child process |
This test program quickly leaks memory, as can be seen in the Task Manager.
#!perl
use warnings;
use strict;
use Win32::Console;
use Win32API::File qw(FdGetOsFHandle);
TRY: while (1) {
my $pid = fork();
# fork() failed.
next TRY unless defined $pid;
# Parent.
if ($pid) {
# Wait for child.
waitpid($pid, 0);
next TRY;
}
# Child.
Win32::Console::_SetStdHandle(
STD_INPUT_HANDLE(),
FdGetOsFHandle(fileno(STDIN))
);
exit(0);
}