Coverity: fix session resource leak