example2.cpp 329 B

1234567891011121314151617
  1. #include <stdlib.h>
  2. int main() {
  3. int *pi;
  4. int i;
  5. #ifdef DUMA_EXPLICIT_INIT
  6. duma_init();
  7. #endif
  8. pi = (int *)malloc(10 * sizeof(int));
  9. for (i = 0; i < 10; ++i)
  10. pi[i] = i;
  11. return 0;
  12. // pi is not freed
  13. // that should produce a memory leak
  14. // without information on allocation source without including duma.h
  15. }