From b54d2dde407921caa7561dde6b45831ba93d0840 Mon Sep 17 00:00:00 2001 From: Hisham Date: Tue, 2 Feb 2016 15:53:02 +0100 Subject: Check for failure in allocations. --- Vector.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Vector.c') diff --git a/Vector.c b/Vector.c index 8200564c..0cdf9af2 100644 --- a/Vector.c +++ b/Vector.c @@ -37,9 +37,9 @@ Vector* Vector_new(ObjectClass* type, bool owner, int size) { if (size == DEFAULT_SIZE) size = 10; - this = malloc(sizeof(Vector)); + this = xMalloc(sizeof(Vector)); this->growthRate = size; - this->array = (Object**) calloc(size, sizeof(Object*)); + this->array = (Object**) xCalloc(size, sizeof(Object*)); this->arraySize = size; this->items = 0; this->type = type; @@ -179,7 +179,7 @@ static void Vector_checkArraySize(Vector* this) { //int i; //i = this->arraySize; this->arraySize = this->items + this->growthRate; - this->array = (Object**) realloc(this->array, sizeof(Object*) * this->arraySize); + this->array = (Object**) xRealloc(this->array, sizeof(Object*) * this->arraySize); //for (; i < this->arraySize; i++) // this->array[i] = NULL; } -- cgit v1.2.3