If he replaced "int * _counters;" with "vector<int> _counters;" he would have lost nothing and gained a lot of control. As for the pointer to the Snd object itself, in many cases it is sufficient to create object, not pointer, and pass the reference of the object, then in case of exception memory is always freed no matter how many ints he has push_back'ed and where the exception occurred. And if he really needs to have pointer, then he should create that pointer not in naked function that could return at any time, but make it a member of a class and delete the pointer in destructor. Then make that class as object, which will always execute its destructor, therefore always freeing the memory.