dinput: Guard against the case where malloc fails