fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class P{
  6. private:
  7. int* i=new int(5);
  8. public:
  9. ~P(){delete i;};
  10. int a(){return *i;};
  11. };
  12.  
  13. void f(P p){};
  14.  
  15. int main()
  16. {
  17. P a;
  18. cout<<a.a()<<endl;
  19. f(a);
  20. cout<<a.a()<<endl;
  21. return 0;
  22. }
Runtime error #stdin #stdout #stderr 0s 3416KB
stdin
Standard input is empty
stdout
5
0
stderr
*** Error in `./prog': double free or corruption (fasttop): 0x08bd5a10 ***