Skip to content

Commit 790c6da

Browse files
chkuang-ga-maurice
authored andcommitted
Nullify internal_ pointer when DataSnapshot is delete.
This might not fix b/133190790 but just in case DataSnapshot can still be accessed after deletion. PiperOrigin-RevId: 249670825
1 parent b819e85 commit 790c6da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

database/src/common/data_snapshot.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ DataSnapshot& DataSnapshot::operator=(DataSnapshot&& snapshot) {
9191

9292
DataSnapshot::~DataSnapshot() {
9393
CleanupFnDataSnapshot::Unregister(this, internal_);
94-
if (internal_) {
95-
delete internal_;
96-
}
94+
95+
delete internal_;
96+
internal_ = nullptr;
9797
}
9898

9999
bool DataSnapshot::exists() const { return internal_ && internal_->Exists(); }

0 commit comments

Comments
 (0)