Commit b6111370 authored by Alex Brainman's avatar Alex Brainman

runtime: free memory allocated by windows CommandLineToArgv

R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/3003043
parent e8605b12
...@@ -85,7 +85,7 @@ runtime·windows_goargs(void) ...@@ -85,7 +85,7 @@ runtime·windows_goargs(void)
extern Slice os·Args; extern Slice os·Args;
extern Slice os·Envs; extern Slice os·Envs;
void *gcl, *clta, *ges, *fes; void *gcl, *clta, *ges, *fes, *lf;
uint16 *cmd, *env, **argv; uint16 *cmd, *env, **argv;
String *gargv; String *gargv;
String *genvv; String *genvv;
...@@ -95,6 +95,7 @@ runtime·windows_goargs(void) ...@@ -95,6 +95,7 @@ runtime·windows_goargs(void)
gcl = runtime·get_proc_addr("kernel32.dll", "GetCommandLineW"); gcl = runtime·get_proc_addr("kernel32.dll", "GetCommandLineW");
clta = runtime·get_proc_addr("shell32.dll", "CommandLineToArgvW"); clta = runtime·get_proc_addr("shell32.dll", "CommandLineToArgvW");
ges = runtime·get_proc_addr("kernel32.dll", "GetEnvironmentStringsW"); ges = runtime·get_proc_addr("kernel32.dll", "GetEnvironmentStringsW");
lf = runtime·get_proc_addr("kernel32.dll", "LocalFree");
fes = runtime·get_proc_addr("kernel32.dll", "FreeEnvironmentStringsW"); fes = runtime·get_proc_addr("kernel32.dll", "FreeEnvironmentStringsW");
cmd = runtime·stdcall(gcl, 0); cmd = runtime·stdcall(gcl, 0);
...@@ -123,6 +124,7 @@ runtime·windows_goargs(void) ...@@ -123,6 +124,7 @@ runtime·windows_goargs(void)
os·Envs.len = envc; os·Envs.len = envc;
os·Envs.cap = envc; os·Envs.cap = envc;
runtime·stdcall(lf, 1, argv);
runtime·stdcall(fes, 1, env); runtime·stdcall(fes, 1, env);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment