From e96942e821dec273b884fec378cc2a97a7f5d689 Mon Sep 17 00:00:00 2001 From: Karsten Blees Date: Thu, 17 Jul 2014 17:37:57 +0200 Subject: Win32: fix environment memory leaks All functions that modify the environment have memory leaks. Disable gitunsetenv in the Makefile and use env_setenv (via mingw_putenv) instead (this frees removed environment entries). Move xstrdup from env_setenv to make_augmented_environ, so that mingw_putenv no longer copies the environment entries (according to POSIX [1], "the string [...] shall become part of the environment"). This also fixes the memory leak in gitsetenv, which expects a POSIX compliant putenv. [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/putenv.html Note: This patch depends on taking control of char **environ and having our own mingw_putenv (both introduced in "Win32: Unicode environment (incoming)"). Signed-off-by: Karsten Blees Signed-off-by: Stepan Kasal Signed-off-by: Junio C Hamano --- config.mak.uname | 2 -- 1 file changed, 2 deletions(-) (limited to 'config.mak.uname') diff --git a/config.mak.uname b/config.mak.uname index 8131c81985..462988e8ab 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -326,7 +326,6 @@ ifeq ($(uname_S),Windows) NO_IPV6 = YesPlease NO_UNIX_SOCKETS = YesPlease NO_SETENV = YesPlease - NO_UNSETENV = YesPlease NO_STRCASESTR = YesPlease NO_STRLCPY = YesPlease NO_MEMMEM = YesPlease @@ -479,7 +478,6 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_SYMLINK_HEAD = YesPlease NO_UNIX_SOCKETS = YesPlease NO_SETENV = YesPlease - NO_UNSETENV = YesPlease NO_STRCASESTR = YesPlease NO_STRLCPY = YesPlease NO_MEMMEM = YesPlease -- cgit v1.2.3