This is a memory leak waiting to happen. Please use a smart pointer here (std::auto_ptr or something from boost, since we are not yet on c++11). It is generally not a great idea to assign an object created with new to a naked pointer, if this pointer is a local variable.