CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/external/source/byakugan/test/testDoubleFree.c
Views: 11779
1
#include <windows.h>
2
3
#define NUMPTRS 10
4
5
int main(int argc, char **argv) {
6
char *foo[NUMPTRS];
7
int i;
8
9
Sleep(10000);
10
11
for (i = 0; i < NUMPTRS; i++) {
12
foo[i] = malloc(256);
13
printf("%d: 0x%08x\n", i, foo[i]);
14
}
15
for (i = 0; i < NUMPTRS; i+=2) {
16
free(foo[i]);
17
}
18
free(foo[i-2]);
19
}
20
21