From 484c6b360f4da17c5034aa1408b3a3bef092eeea Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 12 Feb 2020 13:16:18 +0100 Subject: Reviewed Cppcheck issues #1098 --- src/text.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/text.c') diff --git a/src/text.c b/src/text.c index 1be69b99..f8300d61 100644 --- a/src/text.c +++ b/src/text.c @@ -1446,7 +1446,7 @@ char *TextToUtf8(int *codepoints, int length) { // We allocate enough memory fo fit all possible codepoints // NOTE: 5 bytes for every codepoint should be enough - char *text = (char *)calloc(length*5, 1); + char *text = (char *)RL_CALLOC(length*5, 1); const char *utf8 = NULL; int size = 0; @@ -1458,7 +1458,9 @@ char *TextToUtf8(int *codepoints, int length) } // Resize memory to text length + string NULL terminator - text = RL_REALLOC(text, size + 1); + void *ptr = RL_REALLOC(text, size + 1); + + if (ptr != NULL) text = (char *)ptr; return text; } -- cgit v1.2.3