aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/fhandler_console.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-06-05 17:59:46 +0000
committerCorinna Vinschen <corinna@vinschen.de>2001-06-05 17:59:46 +0000
commit235661a37f9bfcc1f4bd8fe0adee795275e47d1f (patch)
tree6d638b66b0dcbf57bc5252dec3d42bc7206c95f6 /winsup/cygwin/fhandler_console.cc
parent149da470f31c237d82903e106f029d1e0b392542 (diff)
downloadnewlib-235661a37f9bfcc1f4bd8fe0adee795275e47d1f.zip
newlib-235661a37f9bfcc1f4bd8fe0adee795275e47d1f.tar.gz
newlib-235661a37f9bfcc1f4bd8fe0adee795275e47d1f.tar.bz2
* fhandler_console.cc (fhandler_console::dup): Allocate space for
savebuf on Cygwin heap. (fhandler_console::char_command): Ditto. Use correct values for size.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r--winsup/cygwin/fhandler_console.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index b6408e5..cf95ecc 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -624,7 +624,7 @@ fhandler_console::dup (fhandler_base *child)
fhc->savebufsiz = savebufsiz;
if (savebuf)
{
- fhc->savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) *
+ fhc->savebuf = (PCHAR_INFO) cmalloc (HEAP_1_BUF, sizeof (CHAR_INFO) *
savebufsiz.X * savebufsiz.Y);
memcpy (fhc->savebuf, savebuf, sizeof (CHAR_INFO) *
savebufsiz.X * savebufsiz.Y);
@@ -1174,12 +1174,12 @@ fhandler_console::char_command (char c)
if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
break;
- savebufsiz.X = now.srWindow.Right - now.srWindow.Left;
- savebufsiz.Y = now.srWindow.Bottom - now.srWindow.Top;
+ savebufsiz.X = now.srWindow.Right - now.srWindow.Left + 1;
+ savebufsiz.Y = now.srWindow.Bottom - now.srWindow.Top + 1;
if (savebuf)
- free (savebuf);
- savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) *
+ cfree (savebuf);
+ savebuf = (PCHAR_INFO) cmalloc (HEAP_1_BUF, sizeof (CHAR_INFO) *
savebufsiz.X * savebufsiz.Y);
ReadConsoleOutputA (get_output_handle (), savebuf,
@@ -1199,7 +1199,7 @@ fhandler_console::char_command (char c)
WriteConsoleOutputA (get_output_handle (), savebuf,
savebufsiz, cob, &now.srWindow);
- free (savebuf);
+ cfree (savebuf);
savebuf = NULL;
savebufsiz.X = savebufsiz.Y = 0;
}