Ashamed to admit... an off-by-one error in malloc