Skip to content

Commit

Permalink
do not leave dangling pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Jan 17, 2025
1 parent 458f8f6 commit ed1450e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/objstore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Value PyObjectWrap::New(Napi::Env env, PyStrongRef &&obj) {
// Retrieve the existing object from the store
VERBOSE_PYOBJ(OBJS, *obj, "Objstore retrieve");
js = it->second->Value();
// Do not forget to invalidate the passed reference
obj = nullptr;
}

return js;
Expand Down

0 comments on commit ed1450e

Please sign in to comment.