--- a/src/string.c Thu May 15 15:43:30 2025 +0200 +++ b/src/string.c Thu May 15 16:02:54 2025 +0200 @@ -65,7 +65,7 @@ void cx_strfree(cxmutstr *str) { if (str == NULL) return; - free(str->ptr); + cxFree(cxDefaultAllocator, str->ptr); str->ptr = NULL; str->length = 0; } @@ -286,8 +286,9 @@ // check needle length and use appropriate prefix table // if the pattern exceeds static prefix table, allocate on the heap const bool useheap = needle.length >= CX_STRSTR_SBO_SIZE; - register size_t *ptable = useheap ? calloc(needle.length + 1, - sizeof(size_t)) : s_prefix_table; + register size_t *ptable = useheap + ? cxCalloc(cxDefaultAllocator, needle.length + 1, sizeof(size_t)) + : s_prefix_table; // keep counter in registers register size_t i, j; @@ -325,7 +326,7 @@ // if prefix table was allocated on the heap, free it if (useheap) { - free(ptable); + cxFree(cxDefaultAllocator, ptable); } return result;