This is just a memory leak.
But I clearly remember the standard saying that using new with delete[] and new [] with delete is undefined behavior. (or any combination with malloc or free )
I don't think the standard specifically says that calling new leads to undefined behavior unless you call delete . Also, how can runtime indicate if you call delete sometime later or never call it at all?
I don’t think there are any contracts in the standard that say - if you do X , you SHOULD make Y , otherwise it is UB.
Luchian Grigore Mar 29 '12 at 7:40 2012-03-29 07:40
source share