mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
updates to run valgrind on test-api
This commit is contained in:
parent
bc8f23aa0d
commit
eee7c40da5
8 changed files with 39 additions and 12 deletions
|
@ -72,7 +72,9 @@ int main(void) {
|
|||
result = (mi_calloc((size_t)&mi_calloc,SIZE_MAX/1000) == NULL);
|
||||
};
|
||||
CHECK_BODY("calloc0") {
|
||||
result = (mi_usable_size(mi_calloc(0,1000)) <= 16);
|
||||
void* p = mi_calloc(0,1000);
|
||||
result = (mi_usable_size(p) <= 16);
|
||||
mi_free(p);
|
||||
};
|
||||
CHECK_BODY("malloc-large") { // see PR #544.
|
||||
void* p = mi_malloc(67108872);
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
int main(int argc, char** argv) {
|
||||
int* p = mi(malloc)(3*sizeof(int));
|
||||
int* q = mi(malloc)(sizeof(int));
|
||||
|
||||
|
||||
int* r = mi_malloc_aligned(8,16);
|
||||
mi_free(r);
|
||||
|
||||
// undefined access
|
||||
// printf("undefined: %d\n", *q);
|
||||
|
||||
|
@ -23,7 +26,7 @@ int main(int argc, char** argv) {
|
|||
mi(free)(q);
|
||||
|
||||
// double free
|
||||
mi(free)(q);
|
||||
// mi(free)(q);
|
||||
|
||||
// use after free
|
||||
printf("use-after-free: %d\n", *q);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue