fix more ressource and memory leaks (not reported by cppcheck)