We propose a unified framework for equity and credit risk modeling, where the default time is a doubly stochastic random time with intensity driven by an underlying affine factor process. This approach allows for flexible interactions between the defaultable stock price, its stochastic volatility and the default intensity, while maintaining full analytical tractability. We characterise all riskneutral measures which preserve the affine structure of the model and show that risk management as well as pricing problems can be dealt with efficiently by shifting to suitable survival measures. As an example, we consider a jump-to-default extension of the Heston stochastic volatility model.