peres: Fix possible memory leaks introduced by 518d39b.