[ create a new paste ] login | about

Link: http://codepad.org/R5rEDA2g    [ raw code | output | fork ]

aaronla - C, pasted on Apr 23:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>

int main()
{
    int* p = malloc(sizeof(int));
    free(p);
    
    malloc(sizeof(int));

    // at this point, p has already been freed;
    *p = 2;
    printf("no crash.\n");
    
    return 0;
}


Output:
1
no crash.


Create a new paste based on this one


Comments: