diff options
author | Nicolas Noble <nnoble@google.com> | 2017-10-10 09:49:10 -0700 |
---|---|---|
committer | Nicolas Noble <nnoble@google.com> | 2017-10-10 09:49:10 -0700 |
commit | 3290e49a1d5b896b7ce65d658ffef00bf65d35dd (patch) | |
tree | 132f79cb90bf99740cbeefd694f37a8a4ca7c527 /src/core/lib | |
parent | b6142ef1a6dc70565f468346c7935f43dbcb55fa (diff) |
Fixing Windows's memory leak.
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/support/env_windows.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/lib/support/env_windows.cc b/src/core/lib/support/env_windows.cc index 73c643c560..a0b7846808 100644 --- a/src/core/lib/support/env_windows.cc +++ b/src/core/lib/support/env_windows.cc @@ -43,7 +43,10 @@ char *gpr_getenv(const char *name) { DWORD ret; ret = GetEnvironmentVariable(tname, NULL, 0); - if (ret == 0) return NULL; + if (ret == 0) { + gpr_free(tname); + return NULL; + } size = ret * (DWORD)sizeof(TCHAR); tresult = (LPTSTR)gpr_malloc(size); ret = GetEnvironmentVariable(tname, tresult, size); |