We don't bound the size of the allocation for the jitter window, so it's
possible to request up to 16GB of memory, and on 32-bit systems, the
multiplication can overflow. Bound the allocation to the size of the
context.
Ensure that km_elem is freed if we hit the error case.
Reported by: AEGIS and Equilateral AI