mirror of
https://github.com/golang/go
synced 2024-11-24 22:27:57 -07:00
runtime: free memory allocated by windows CommandLineToArgv
R=golang-dev, r2 CC=golang-dev https://golang.org/cl/3003043
This commit is contained in:
parent
e8605b1279
commit
b611137098
@ -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)
|
|||||||
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)
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user