From 37b3fc7f4290abffd51f486d8f02e5f8953bf6e9 Mon Sep 17 00:00:00 2001 From: kmazouzi Date: Tue, 22 Mar 2016 20:39:14 +0100 Subject: [PATCH] add leak --- lab2/leak.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lab2/leak.c 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; +} -- 1.7.10.4