fixes memory leak for getAppFilename on Windows

This commit is contained in:
Araq 2015-11-26 21:20:10 +01:00
commit 22ed2aab35

View file

@ -1361,7 +1361,7 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect].} =
# /proc/<pid>/file
when defined(windows):
when useWinUnicode:
var buf = cast[WideCString](alloc(256*2))
var buf = newWideCString("", 256)
var len = getModuleFileNameW(0, buf, 256)
result = buf$len
else: