Skip to content

Commit b7c1038

Browse files
nornagonaddaleax
authored andcommitted
src: initialize pid variable before goto
This fixes an error when compiling with clang-cl on Windows: ``` src/node.cc(2437,5): error: jump from this goto statement to its label is a Microsoft extension [-Werror,-Wmicrosoft-goto] goto out; ^ src/node.cc(2441,9): note: jump bypasses variable initialization DWORD pid = args[0].As<Integer>()->Value(); ^ ``` PR-URL: #22961 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 676bd5f commit b7c1038

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,14 +2271,15 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
22712271
HANDLE mapping = nullptr;
22722272
wchar_t mapping_name[32];
22732273
LPTHREAD_START_ROUTINE* handler = nullptr;
2274+
DWORD pid = 0;
22742275

22752276
if (args.Length() != 1) {
22762277
env->ThrowError("Invalid number of arguments.");
22772278
goto out;
22782279
}
22792280

22802281
CHECK(args[0]->IsNumber());
2281-
DWORD pid = args[0].As<Integer>()->Value();
2282+
pid = args[0].As<Integer>()->Value();
22822283

22832284
process = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION |
22842285
PROCESS_VM_OPERATION | PROCESS_VM_WRITE |

0 commit comments

Comments
 (0)