void cleanup(char *msg) { SDL_FreeSurface(m_Background); while (m_IconList.size() != 0) { delete m_IconList.back(); m_IconList.pop_back(); } throw msg; } ... catch (char* errorStr) { cleanup(errorStr); } catch (std::bad_alloc) { cleanup("Out of memory\n"); }?