Fixed c++ readers memory leak