c++ 动态内存分配

void main() { int * p; p=new int(8); cout <<*p<<endl; // delete p; p=new int (9); cout<<*p<<endl; delete p; }
为什么我分配两次内存空间,最后只是回收了一次,但是编译器不报错说内存泄漏呢?
void main() { int * p; p=new int(8); cout <<*p<<endl; // delete p; p=new int (9); cout<<*p<<endl; delete p; }