// An example of a C++ class that has memory leaks. Filter::Filter() { buf = 0; } Filter::AllocateBuffer(int n) { buf = new int [n]; } Filter::DeallocateBuffer() { if (buf) delete buf; } Filter::~Filter() { DeallocateBuffer(); }