GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: fix module buffer allocation · nodejs/node@abeb5c4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • debug_utils.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/debug_utils.cc‎

Copy file name to clipboardExpand all lines: src/debug_utils.cc
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ std::vector<std::string> NativeSymbolDebuggingContext::GetLoadedLibraries() {
471471
DWORD size_2 = 0;
472472
// First call to get the size of module array needed
473473
if (EnumProcessModules(process_handle, nullptr, 0, &size_1)) {
474-
MallocedBuffer<HMODULE> modules(size_1);
474+
MallocedBuffer<HMODULE> modules(size_1 / sizeof(HMODULE));
475475

476476
// Second call to populate the module array
477477
if (EnumProcessModules(process_handle, modules.data, size_1, &size_2)) {
@@ -480,16 +480,15 @@ std::vector<std::string> NativeSymbolDebuggingContext::GetLoadedLibraries() {
480480
i++) {
481481
WCHAR module_name[MAX_PATH];
482482
// Obtain and report the full pathname for each module
483-
if (GetModuleFileNameExW(process_handle,
484-
modules.data[i],
485-
module_name,
486-
arraysize(module_name) / sizeof(WCHAR))) {
483+
if (GetModuleFileNameW(
484+
modules.data[i], module_name, arraysize(module_name))) {
487485
DWORD size = WideCharToMultiByte(
488486
CP_UTF8, 0, module_name, -1, nullptr, 0, nullptr, nullptr);
489487
char* str = new char[size];
490488
WideCharToMultiByte(
491489
CP_UTF8, 0, module_name, -1, str, size, nullptr, nullptr);
492490
list.emplace_back(str);
491+
delete str;
493492
}
494493
}
495494
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.