Blame view

lab2/leak.c 242 Bytes
37b3fc7f4   kmazouzi   add leak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #include <stdlib.h>
  #include <stdio.h>
  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 
  ");
      return 0;
  }