Fix Session::prepare memory leak.