Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 33b0906

Browse filesBrowse files
RaisinTenRafaelGSS
authored andcommitted
sea: fix memory leak detected by asan
Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #47309 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 910d296 commit 33b0906
Copy full SHA for 33b0906

File tree

Expand file treeCollapse file tree

2 files changed

+7
-18
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-18
lines changed
Open diff view settings
Collapse file

‎src/node_sea.cc‎

Copy file name to clipboardExpand all lines: src/node_sea.cc
+7-13Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,13 @@ std::tuple<int, char**> FixupArgsForSEA(int argc, char** argv) {
9191
// Repeats argv[0] at position 1 on argv as a replacement for the missing
9292
// entry point file path.
9393
if (IsSingleExecutable()) {
94-
char** new_argv = new char*[argc + 2];
95-
int new_argc = 0;
96-
new_argv[new_argc++] = argv[0];
97-
new_argv[new_argc++] = argv[0];
98-
99-
for (int i = 1; i < argc; ++i) {
100-
new_argv[new_argc++] = argv[i];
101-
}
102-
103-
new_argv[new_argc] = nullptr;
104-
105-
argc = new_argc;
106-
argv = new_argv;
94+
static std::vector<char*> new_argv;
95+
new_argv.reserve(argc + 2);
96+
new_argv.emplace_back(argv[0]);
97+
new_argv.insert(new_argv.end(), argv, argv + argc);
98+
new_argv.emplace_back(nullptr);
99+
argc = new_argv.size() - 1;
100+
argv = new_argv.data();
107101
}
108102

109103
return {argc, argv};
Collapse file

‎test/parallel/test-single-executable-application.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-single-executable-application.js
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ if (!process.config.variables.single_executable_application)
1616
if (!['darwin', 'win32', 'linux'].includes(process.platform))
1717
common.skip(`Unsupported platform ${process.platform}.`);
1818

19-
if (process.platform === 'linux' && process.config.variables.asan) {
20-
// Source of the memory leak - https://github.com/nodejs/node/blob/da0bc6db98cef98686122ea1e2cd2dbd2f52d123/src/node_sea.cc#L94.
21-
common.skip('Running the resultant binary fails because of a memory leak ASAN error.');
22-
}
23-
2419
if (process.platform === 'linux' && process.config.variables.is_debug === 1)
2520
common.skip('Running the resultant binary fails with `Couldn\'t read target executable"`.');
2621

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.