The following comment is in several places in the code:
// BUG - These can not currenrtly be deleted. // The code is no consistant here. In places a new vector is returned // in others a reference to a vector that is managed by other code is returned. //delete tmp; //tmp = NULL;
This needs to be cleaned up so that memory doesn't leak.