history: avoid heap exhaustion on load

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>