summaryrefslogtreecommitdiffstats
path: root/RichString.c
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2016-02-02 15:53:02 +0100
committerHisham <hisham@gobolinux.org>2016-02-02 15:53:02 +0100
commitb54d2dde407921caa7561dde6b45831ba93d0840 (patch)
treecd81eea35dd65e46d22f2801ea403e1efc06eb59 /RichString.c
parenta1f7f2869ec2bd860d5b4e4b39736ca877afdf6f (diff)
Check for failure in allocations.
Diffstat (limited to 'RichString.c')
-rw-r--r--RichString.c5
1 files changed, 3 insertions, 2 deletions
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 <stdlib.h>
#include <string.h>
@@ -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));
}
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy