From Wolfgang Schmieder <wolfgang@die-schmieders.de>: Fix memory leaks fromconfiguration reading code, and clean up error handling.