diff --git a/lab2/leak.c b/lab2/leak.c new file mode 100644 index 0000000..4c09146 --- /dev/null +++ b/lab2/leak.c @@ -0,0 +1,13 @@ +#include +#include +void f(void) +{ + int* x = (int*)malloc(10 * sizeof(int)); + x[9] = 2; +} // problem: memory leak -- x not freed +int main(int argc, char * argv[]) +{ + f(); + printf("GOOD END \n"); + return 0; +}