Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion authenticate_pam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ void after_doing_auth(uv_work_t* req, int status) {
args[0] = Nan::New<String>(m->errorString.c_str()).ToLocalChecked();
}

Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(m->callback), 1, args);
Nan::AsyncResource *asyncResource = new Nan::AsyncResource("callback");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a clean change ... but my question is what is calling delete on asyncResource ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without delete we might have a memory leak.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you 100% sure that the new NAN APIs and node 12 won't take care of it ? do you have some sort of setup to run some tests....or at least tell me how to do it ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could test it by running the code in debug mode and with valgrind to check for memory leaks.

asyncResource->runInAsyncScope(Nan::GetCurrentContext()->Global(), Nan::New(m->callback), 1, args);

m->callback.Reset();

Expand Down