Egbugfixes valgrind errs72 x

This are the fixes for memory leaks that were fixed in january but by mistake never got merged into CMSSW. Second attempt at pull request as the first one seemed to not to be merged automatically once created for some reason
NOTE: you could make your life infinitely easier if you switched to using ```std::unique_ptr<>``` instead of bare pointers.