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. --- RichString.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'RichString.c') diff --git a/RichString.c b/RichString.c index 75198330..e7dd4e83 100644 --- a/RichString.c +++ b/RichString.c @@ -6,6 +6,7 @@ in the source distribution for its full text. */ #include "RichString.h" +#include "XAlloc.h" #include #include @@ -67,7 +68,7 @@ typedef struct RichString_ { static void RichString_extendLen(RichString* this, int len) { if (this->chlen <= RICHSTRING_MAXLEN) { if (len > RICHSTRING_MAXLEN) { - this->chptr = malloc(charBytes(len + 1)); + this->chptr = xMalloc(charBytes(len + 1)); memcpy(this->chptr, this->chstr, charBytes(this->chlen)); } } else { @@ -76,7 +77,7 @@ static void RichString_extendLen(RichString* this, int len) { free(this->chptr); this->chptr = this->chstr; } else { - this->chptr = realloc(this->chptr, charBytes(len + 1)); + this->chptr = xRealloc(this->chptr, charBytes(len + 1)); } } -- cgit v1.2.3