Fix minor memory leak

When an error occurs loading the history