tests: add test-libmallocwrap
[ust.git] / tests / test-libmallocwrap / prog.c
CommitLineData
e6ef4111
PMF
1#include <string.h>
2#include <stdlib.h>
3
4#define N_ITER 1000
5
6int main()
7{
8 int i;
9 const char teststr[] = "Hello World! 1234567890abc";
10 void *ptrs[N_ITER];
11
12 for(i=0; i<N_ITER; i++) {
13 ptrs[i] = malloc(i+1000);
14
15 memcpy(ptrs[i], teststr, sizeof(teststr));
16
17 if(i%2 == 0) {
18 free(ptrs[i]);
19 }
20 }
21
22 for(i=0; i<N_ITER; i++) {
23 if(i%2 == 1)
24 free(ptrs[i]);
25 }
26
27 return 0;
28}
This page took 0.024126 seconds and 4 git commands to generate.