use GFX2_malloc() to log allocation errors

also check malloc() return more often
This commit is contained in:
Thomas Bernard
2019-05-04 17:52:34 +02:00
parent 7f78f3ec72
commit c051ac2189
8 changed files with 139 additions and 102 deletions

View File

@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include "gfx2mem.h"
#include "unicode.h"
size_t Unicode_strlen(const word * str)
@@ -43,7 +44,7 @@ word * Unicode_strdup(const word * str)
if (str == NULL)
return NULL;
byte_size = Unicode_strlen(str) * 2 + 2;
new_str = malloc(byte_size);
new_str = GFX2_malloc(byte_size);
if (new_str != NULL)
memcpy(new_str, str, byte_size);
return new_str;