]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/interpose-malloc.dtest/interposer.c
dyld-851.27.tar.gz
[apple/dyld.git] / testing / test-cases / interpose-malloc.dtest / interposer.c
1 #include <stdlib.h>
2 #include <string.h>
3 #include <mach-o/dyld-interposing.h>
4
5
6
7 void* mymalloc(size_t size)
8 {
9 // bump ptr allocate twice the size and fills with '#'
10 char* result = malloc(size*2);
11 memset(result, '#', size*2);
12 return result;
13 }
14
15 void myfree(void* p)
16 {
17 free(p);
18 }
19
20 DYLD_INTERPOSE(mymalloc, malloc)
21 DYLD_INTERPOSE(myfree, free)