There is a memory leak here, since odompub_ is never deleted. I'd suggest using a shared_ptr