[CMD] Clear global pointer to local variable after use

GCC 13 doesn't like if you keep a dangling pointer around.

C:/ReactOS/reactos/base/shell/cmd/for.c: In function 'ForF':
C:/ReactOS/reactos/base/shell/cmd/for.c:307:20: error: storing the address of local variable 'Variables' in '*fc.values' [-Werror=dangling-pointer=]
  307 |         fc->values = Variables;
      |         ~~~~~~~~~~~^~~~~~~~~~~
C:/ReactOS/reactos/base/shell/cmd/for.c:141:12: note: 'Variables' declared here
  141 |     LPTSTR Variables[32];
      |            ^~~~~~~~~
C:/ReactOS/reactos/base/shell/cmd/for.c:57:14: note: 'fc' declared here
   57 | PFOR_CONTEXT fc = NULL;
      |              ^~
This commit is contained in:
Timo Kreuzer
2026-03-18 17:29:12 +02:00
parent f2b85d2a79
commit 3413675193
+1
View File
@@ -474,6 +474,7 @@ Quit:
if (fc->values && (fc->values != Variables))
cmd_free(fc->values);
#endif
fc->values = NULL;
return Ret;
}