diff options
author | Hisham <hisham@gobolinux.org> | 2016-02-02 15:53:02 +0100 |
---|---|---|
committer | Hisham <hisham@gobolinux.org> | 2016-02-02 15:53:02 +0100 |
commit | b54d2dde407921caa7561dde6b45831ba93d0840 (patch) | |
tree | cd81eea35dd65e46d22f2801ea403e1efc06eb59 /Vector.c | |
parent | a1f7f2869ec2bd860d5b4e4b39736ca877afdf6f (diff) |
Check for failure in allocations.
Diffstat (limited to 'Vector.c')
-rw-r--r-- | Vector.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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; } |