-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os: fix memory leak in userInfo()
#23893
Conversation
This previously leaked memory in the ‘success’ case.
src/node_os.cc
Outdated
@@ -360,6 +360,7 @@ static void GetUserInfo(const FunctionCallbackInfo<Value>& args) { | |||
} | |||
|
|||
const int err = uv_os_get_passwd(&pwd); | |||
OnScopeLeave free_passwd([&]() { uv_os_free_passwd(&pwd); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it safe to call it if uv_os_get_passwd
returned an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think you’re right, we shouldn’t do that. I’ve moved it below the conditional 👍
Landed in d690a87. |
This previously leaked memory in the ‘success’ case. PR-URL: #23893 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This previously leaked memory in the ‘success’ case. PR-URL: #23893 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Lands cleanly on 10 but not on 8 It would appear the leak actually doesn't exist on 8 so I'm marking as don't land |
This previously leaked memory in the ‘success’ case. PR-URL: #23893 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This previously leaked memory in the ‘success’ case. PR-URL: #23893 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This previously leaked memory in the ‘success’ case. PR-URL: #23893 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This previously leaked memory in the ‘success’ case.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes