Harden Inputs::setup_sample_method() in case of malloc failure.