Skip to content

Commit 5066736

Browse files
authored
src: fix module buffer allocation
nodejs/node#57738
1 parent 3ea565b commit 5066736

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

patches/node/.patches

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ fix_cppgc_initializing_twice.patch
4747
fix_task_starvation_in_inspector_context_test.patch
4848
fix_expose_readfilesync_override_for_modules.patch
4949
chore_remove_protocol_maybe_from_node_string.patch
50+
fix_-wmismatched-new-delete_in_debug_utils_cc.patch
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Shelley Vohr <shelley.vohr@gmail.com>
3+
Date: Thu, 26 Jun 2025 12:46:41 +0000
4+
Subject: fix: -Wmismatched-new-delete in debug_utils.cc
5+
6+
Fixes the following error:
7+
8+
Error: ../../third_party/electron_node/src/debug_utils.cc(491,11): error: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Werror,-Wmismatched-new-delete]
9+
491 | delete str;
10+
| ^
11+
| []
12+
../../third_party/electron_node/src/debug_utils.cc(487,23): note: allocated with 'new[]' here
13+
487 | char* str = new char[size];
14+
| ^
15+
1 error generated.
16+
17+
Upstreamed in https://github.com/nodejs/node/pull/58844.
18+
19+
diff --git a/src/debug_utils.cc b/src/debug_utils.cc
20+
index 97884b9a0f8d6d88e36da06b05642505c767338d..65283ef31da35d0f08fcff7a5e79bf960d861126 100644
21+
--- a/src/debug_utils.cc
22+
+++ b/src/debug_utils.cc
23+
@@ -488,7 +488,7 @@ std::vector<std::string> NativeSymbolDebuggingContext::GetLoadedLibraries() {
24+
WideCharToMultiByte(
25+
CP_UTF8, 0, module_name, -1, str, size, nullptr, nullptr);
26+
list.emplace_back(str);
27+
- delete str;
28+
+ delete[] str;
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)