diff --git a/doc/apiref.rst b/doc/apiref.rst index 463966b..8af0800 100644 --- a/doc/apiref.rst +++ b/doc/apiref.rst @@ -1476,7 +1476,7 @@ JSON structures by zeroing all memory when freed:: ptr -= 8; size = *((size_t *)ptr); - guaranteed_memset(ptr, 0, size); + guaranteed_memset(ptr, 0, size + 8); free(ptr); } diff --git a/test/suites/api/test_memory_funcs.c b/test/suites/api/test_memory_funcs.c index 4d6a81e..8737389 100644 --- a/test/suites/api/test_memory_funcs.c +++ b/test/suites/api/test_memory_funcs.c @@ -65,7 +65,7 @@ static void secure_free(void *ptr) ptr = (char *)ptr - 8; size = *((size_t *)ptr); - /*guaranteed_*/memset(ptr, 0, size); + /*guaranteed_*/memset(ptr, 0, size + 8); free(ptr); }