summaryrefslogtreecommitdiff
path: root/components/libc/cplusplus/cpp11/emutls.c
diff options
context:
space:
mode:
Diffstat (limited to 'components/libc/cplusplus/cpp11/emutls.c')
-rw-r--r--components/libc/cplusplus/cpp11/emutls.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/components/libc/cplusplus/cpp11/emutls.c b/components/libc/cplusplus/cpp11/emutls.c
index bba3c4a8e0..52d1244c92 100644
--- a/components/libc/cplusplus/cpp11/emutls.c
+++ b/components/libc/cplusplus/cpp11/emutls.c
@@ -61,7 +61,7 @@ static __inline void *emutls_memalign_alloc(size_t align, size_t size)
#else
#define EXTRA_ALIGN_PTR_BYTES (align - 1 + sizeof(void *))
char *object;
- if ((object = malloc(EXTRA_ALIGN_PTR_BYTES + size)) == NULL)
+ if ((object = (char *)malloc(EXTRA_ALIGN_PTR_BYTES + size)) == NULL)
abort();
base = (void *)(((uintptr_t)(object + EXTRA_ALIGN_PTR_BYTES)) & ~(uintptr_t)(align - 1));
@@ -181,14 +181,15 @@ emutls_get_address_array(uintptr_t index)
if (array == NULL)
{
uintptr_t new_size = emutls_new_data_array_size(index);
- array = calloc(new_size + 1, sizeof(void *));
+ array = (emutls_address_array *)calloc(new_size + 1, sizeof(void *));
emutls_check_array_set_size(array, new_size);
}
else if (index > array->size)
{
uintptr_t orig_size = array->size;
uintptr_t new_size = emutls_new_data_array_size(index);
- array = realloc(array, (new_size + 1) * sizeof(void *));
+ array = (emutls_address_array *)realloc(array, (new_size + 1) * sizeof(void *));
+
if (array)
memset(array->data + orig_size, 0,
(new_size - orig_size) * sizeof(void *));