diff options
| author | Ray <[email protected]> | 2020-02-12 13:16:18 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2020-02-12 13:16:18 +0100 |
| commit | 484c6b360f4da17c5034aa1408b3a3bef092eeea (patch) | |
| tree | cbb564a72a1ba0353e643d17aa9f76bfcb9db08a /src/text.c | |
| parent | dec85f741a1605b58e7ae819cbbb9bd82f16e60d (diff) | |
| download | raylib-484c6b360f4da17c5034aa1408b3a3bef092eeea.tar.gz raylib-484c6b360f4da17c5034aa1408b3a3bef092eeea.zip | |
Reviewed Cppcheck issues #1098
Diffstat (limited to 'src/text.c')
| -rw-r--r-- | src/text.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; } |
