* fhandler_tape.cc (fhandler_dev_tape::open): Fix memory allocation.

Use Cygwin heap instead of user heap.
        (fhandler_dev_tape::ioctl): Ditto.
This commit is contained in:
Corinna Vinschen 2000-10-31 19:59:16 +00:00
parent dd07a42567
commit 8e32a18e79
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,9 @@
Tue Oct 31 20:56:00 2000 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tape.cc (fhandler_dev_tape::open): Fix memory allocation.
Use Cygwin heap instead of user heap.
(fhandler_dev_tape::ioctl): Ditto.
Tue Oct 31 12:00:06 2000 Christopher Faylor <cgf@cygnus.com> Tue Oct 31 12:00:06 2000 Christopher Faylor <cgf@cygnus.com>
* pinfo.cc (enum_init): Don't suffer silently if we can't load the * pinfo.cc (enum_init): Don't suffer silently if we can't load the

View File

@ -16,6 +16,7 @@ details. */
#include <unistd.h> #include <unistd.h>
#include <sys/mtio.h> #include <sys/mtio.h>
#include "cygheap.h"
#include "cygerrno.h" #include "cygerrno.h"
#include "fhandler.h" #include "fhandler.h"
#include "path.h" #include "path.h"
@ -88,7 +89,7 @@ fhandler_dev_tape::open (const char *path, int flags, mode_t)
varblkop = get.mt_dsreg == 0; varblkop = get.mt_dsreg == 0;
if (devbufsiz > 1L) if (devbufsiz > 1L)
devbuf = new char [ devbufsiz ]; devbuf = (char *) cmalloc (HEAP_BUF, devbufsiz);
/* The following rewind in position 0 solves a problem which appears /* The following rewind in position 0 solves a problem which appears
* in case of multi volume archives: The last ReadFile on first medium * in case of multi volume archives: The last ReadFile on first medium
@ -348,7 +349,7 @@ fhandler_dev_tape::ioctl (unsigned int cmd, void *buf)
size = get.mt_maxblksize; size = get.mt_maxblksize;
ret = NO_ERROR; ret = NO_ERROR;
} }
char *buf = new char [ size ]; char *buf = (char *) cmalloc (HEAP_BUF, size);
if (!buf) if (!buf)
{ {
ret = ERROR_OUTOFMEMORY; ret = ERROR_OUTOFMEMORY;
@ -358,7 +359,7 @@ fhandler_dev_tape::ioctl (unsigned int cmd, void *buf)
{ {
memcpy(buf,devbuf + devbufstart, devbufend - devbufstart); memcpy(buf,devbuf + devbufstart, devbufend - devbufstart);
devbufend -= devbufstart; devbufend -= devbufstart;
delete [] devbuf; cfree (devbuf);
} }
else else
devbufend = 0; devbufend = 0;