aboutsummaryrefslogtreecommitdiff
path: root/lout/misc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lout/misc.cc')
-rw-r--r--lout/misc.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/lout/misc.cc b/lout/misc.cc
index 9b333c93..bffc68f7 100644
--- a/lout/misc.cc
+++ b/lout/misc.cc
@@ -169,8 +169,11 @@ void BitSet::set(int i, bool val)
int newNumBytes = numBytes;
while (8 * i >= newNumBytes)
newNumBytes *= 2;
- bits =
- (unsigned char*)realloc(bits, newNumBytes * sizeof(unsigned char));
+
+ void *vp;
+ assert((vp = realloc(bits, newNumBytes * sizeof(unsigned char))));
+ if (!vp) exit(-2); // when NDEBUG is defined
+ bits = (unsigned char*)vp;
memset(bits + numBytes, 0, newNumBytes - numBytes);
numBytes = newNumBytes;
}