Throw if malloc fails.