summaryrefslogtreecommitdiff
path: root/diskio-windows.cc
diff options
context:
space:
mode:
Diffstat (limited to 'diskio-windows.cc')
-rw-r--r--diskio-windows.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/diskio-windows.cc b/diskio-windows.cc
index 938d7ec..37e5bb5 100644
--- a/diskio-windows.cc
+++ b/diskio-windows.cc
@@ -230,7 +230,11 @@ int DiskIO::Read(void* buffer, int numBytes) {
numBlocks++;
tempSpace = new char [numBlocks * blockSize];
} // if/else
-
+ if (tempSpace == NULL) {
+ cerr << "Unable to allocate memory in DiskIO::Read()! Terminating!\n";
+ exit(1);
+ } // if
+
// Read the data into temporary space, then copy it to buffer
ReadFile(fd, tempSpace, numBlocks * blockSize, &retval, NULL);
for (i = 0; i < numBytes; i++) {
@@ -271,6 +275,10 @@ int DiskIO::Write(void* buffer, int numBytes) {
if ((numBytes % blockSize) != 0) numBlocks++;
tempSpace = new char [numBlocks * blockSize];
} // if/else
+ if (tempSpace == NULL) {
+ cerr << "Unable to allocate memory in DiskIO::Write()! Terminating!\n";
+ exit(1);
+ } // if
// Copy the data to my own buffer, then write it
for (i = 0; i < numBytes; i++) {