Exception-safe code leaves objects in valid states even when exceptions occur. The basic guarantee says objects remain usable after an exception, with no leaks. The strong guarantee says operations either succeed completely or have no effect.
If an exception occurs, the program state is unchanged from before the operation. Use RAII for the basic guarantee automatically. Smart pointers and containers handle cleanup. For strong guarantee, do all work that might throw before modifying state.