[L5] Defer redundant self-null-assignment #31

Closed
opened 2026-06-27 03:54:48 +00:00 by sessamekesh · 1 comment
Owner

File: wasm/src/observable_filestore.cc:13-25

~Defer() {
  if (on_dtor_ != nullptr) {
    on_dtor_();
  }
  on_dtor_ = nullptr;  // no-op on an object being destroyed
}

Setting on_dtor_ = nullptr in the destructor is a no-op. Harmless; drop for clarity.


Filed by an automated AI code review (manual proof-of-concept run). Code locations reference the various-cleanup branch.

**File:** `wasm/src/observable_filestore.cc:13-25` ```cpp ~Defer() { if (on_dtor_ != nullptr) { on_dtor_(); } on_dtor_ = nullptr; // no-op on an object being destroyed } ``` Setting `on_dtor_ = nullptr` in the destructor is a no-op. Harmless; drop for clarity. --- _Filed by an automated AI code review (manual proof-of-concept run). Code locations reference the `various-cleanup` branch._
Author
Owner

Closing - that's intentional, it helps in other UB scenarios (use after free).

Closing - that's intentional, it helps in other UB scenarios (use after free).
Sign in to join this conversation.
No description provided.