summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--win32/win32.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index cc2f095221..c14b11b2b1 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4242,8 +4242,10 @@ ansify_path(void)
wide_path = (WCHAR*)win32_malloc(len*sizeof(WCHAR));
while (wide_path) {
size_t newlen = GetEnvironmentVariableW(L"PATH", wide_path, len);
- if (newlen == 0)
+ if (newlen == 0) {
+ win32_free(wide_path);
return;
+ }
if (newlen < len)
break;
len = newlen;