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. --- Affinity.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Affinity.c') diff --git a/Affinity.c b/Affinity.c index 8e8651be..471e1028 100644 --- a/Affinity.c +++ b/Affinity.c @@ -29,9 +29,9 @@ typedef struct Affinity_ { }*/ Affinity* Affinity_new(ProcessList* pl) { - Affinity* this = calloc(1, sizeof(Affinity)); + Affinity* this = xCalloc(1, sizeof(Affinity)); this->size = 8; - this->cpus = calloc(this->size, sizeof(int)); + this->cpus = xCalloc(this->size, sizeof(int)); this->pl = pl; return this; } @@ -44,7 +44,7 @@ void Affinity_delete(Affinity* this) { void Affinity_add(Affinity* this, int id) { if (this->used == this->size) { this->size *= 2; - this->cpus = realloc(this->cpus, sizeof(int) * this->size); + this->cpus = xRealloc(this->cpus, sizeof(int) * this->size); } this->cpus[this->used] = id; this->used++; -- cgit v1.2.3