]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: free memory allocated by windows CommandLineToArgv
authorAlex Brainman <alex.brainman@gmail.com>
Wed, 10 Nov 2010 23:38:45 +0000 (10:38 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Wed, 10 Nov 2010 23:38:45 +0000 (10:38 +1100)
R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/3003043

src/pkg/runtime/windows/thread.c

index a094b28da4d5391ac3c304b2c70556f02ee1a4b4..6d961beea1bf9a07f4cd4165e3e88e6b51cb1b7f 100644 (file)
@@ -85,7 +85,7 @@ runtime·windows_goargs(void)
        extern Slice os·Args;
        extern Slice os·Envs;
 
-       void *gcl, *clta, *ges, *fes;
+       void *gcl, *clta, *ges, *fes, *lf;
        uint16 *cmd, *env, **argv;
        String *gargv;
        String *genvv;
@@ -95,6 +95,7 @@ runtime·windows_goargs(void)
        gcl = runtime·get_proc_addr("kernel32.dll", "GetCommandLineW");
        clta = runtime·get_proc_addr("shell32.dll", "CommandLineToArgvW");
        ges = runtime·get_proc_addr("kernel32.dll", "GetEnvironmentStringsW");
+       lf = runtime·get_proc_addr("kernel32.dll", "LocalFree");
        fes = runtime·get_proc_addr("kernel32.dll", "FreeEnvironmentStringsW");
 
        cmd = runtime·stdcall(gcl, 0);
@@ -123,6 +124,7 @@ runtime·windows_goargs(void)
        os·Envs.len = envc;
        os·Envs.cap = envc;
 
+       runtime·stdcall(lf, 1, argv);
        runtime·stdcall(fes, 1, env);
 }