Fix memory allocation error
authorbdemsky <bdemsky@uci.edu>
Tue, 11 Jul 2017 00:24:15 +0000 (17:24 -0700)
committerbdemsky <bdemsky@uci.edu>
Tue, 11 Jul 2017 00:24:15 +0000 (17:24 -0700)
src/Encoders/elementencoding.c

index 6ed38c2a95214da6f809c286b2ad5dc8434ccc0d..a5158abf7e06dace78f447a5f53b97fc1841d38a 100644 (file)
@@ -29,7 +29,8 @@ void allocEncodingArrayElement(ElementEncoding *This, uint size) {
 }
 
 void allocInUseArrayElement(ElementEncoding *This, uint size) {
-       This->inUseArray=ourcalloc(1, size >> 6);
+       uint bytes = ((size + ((1 << 9)-1)) >> 6)&~7;//Depends on size of inUseArray
+       This->inUseArray=ourcalloc(1, bytes);
 }
 
 void allocElementConstraintVariables(ElementEncoding* This, uint numVars){