use_after_free_checker.cpp 491 B

12345678910111213141516171819202122
  1. #include "use_after_free_checker.h"
  2. #include <util/system/yassert.h>
  3. namespace {
  4. const ui64 VALID = (ui64)0xAABBCCDDEEFF0011LL;
  5. const ui64 INVALID = (ui64)0x1122334455667788LL;
  6. }
  7. TUseAfterFreeChecker::TUseAfterFreeChecker()
  8. : Magic(VALID)
  9. {
  10. }
  11. TUseAfterFreeChecker::~TUseAfterFreeChecker() {
  12. Y_ABORT_UNLESS(Magic == VALID, "Corrupted");
  13. Magic = INVALID;
  14. }
  15. void TUseAfterFreeChecker::CheckNotFreed() const {
  16. Y_ABORT_UNLESS(Magic == VALID, "Freed or corrupted");
  17. }