Blame view

lab2/memory_leak.c 242 Bytes
c7c188d74   kmazouzi   add memory 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;
  }