aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/use_after_free_checker.cpp
blob: 01f38d8d34de7b46b2941b9f7adc4ee2bae46638 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "use_after_free_checker.h"

#include <util/system/yassert.h>

namespace {
    const ui64 VALID = (ui64)0xAABBCCDDEEFF0011LL; 
    const ui64 INVALID = (ui64)0x1122334455667788LL; 
}

TUseAfterFreeChecker::TUseAfterFreeChecker()
    : Magic(VALID)
{
}

TUseAfterFreeChecker::~TUseAfterFreeChecker() { 
    Y_VERIFY(Magic == VALID, "Corrupted");
    Magic = INVALID;
}

void TUseAfterFreeChecker::CheckNotFreed() const {
    Y_VERIFY(Magic == VALID, "Freed or corrupted");
}