We develop a quantitative equilibrium model of financial crises to assess the interaction between ex-post interventions in credit markets and the buildup of risk ex ante. During a systemic crisis, bailouts relax balance sheet constraints and mitigate the severity of the recession. Ex ante, the anticipation of such bailouts leads to an increase in risk-taking, making the economy more vulnerable to a financial crisis. We find that moral hazard effects are limited if bailouts are systemic and broad-based. If bailouts are idiosyncratic and targeted, however, this makes the economy significantly more exposed to financial crises.