summaryrefslogtreecommitdiffhomepage
path: root/src/text.c
diff options
context:
space:
mode:
authorRay <[email protected]>2020-02-12 13:16:18 +0100
committerRay <[email protected]>2020-02-12 13:16:18 +0100
commit484c6b360f4da17c5034aa1408b3a3bef092eeea (patch)
treecbb564a72a1ba0353e643d17aa9f76bfcb9db08a /src/text.c
parentdec85f741a1605b58e7ae819cbbb9bd82f16e60d (diff)
downloadraylib-484c6b360f4da17c5034aa1408b3a3bef092eeea.tar.gz
raylib-484c6b360f4da17c5034aa1408b3a3bef092eeea.zip
Reviewed Cppcheck issues #1098
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c6
1 files changed, 4 insertions, 2 deletions
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;
}