Fix Windows's memory leak

(cherry picked from commit 3290e49a1d)

clang-format.

(cherry picked from commit c02dbe57c6)
pull/13169/head
Nicolas Noble 7 years ago committed by kkm
parent ed9929e246
commit e3ee18ada9
  1. 5
      src/core/lib/support/env_windows.c

@ -43,7 +43,10 @@ char *gpr_getenv(const char *name) {
DWORD ret; DWORD ret;
ret = GetEnvironmentVariable(tname, NULL, 0); ret = GetEnvironmentVariable(tname, NULL, 0);
if (ret == 0) return NULL; if (ret == 0) {
gpr_free(tname);
return NULL;
}
size = ret * (DWORD)sizeof(TCHAR); size = ret * (DWORD)sizeof(TCHAR);
tresult = gpr_malloc(size); tresult = gpr_malloc(size);
ret = GetEnvironmentVariable(tname, tresult, size); ret = GetEnvironmentVariable(tname, tresult, size);

Loading…
Cancel
Save