New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] remove intentional leak in win32/win32.c ansify_path #13859
Comments
From @bulk88Created by @bulk88Unsmoked. For 5.21 since this is too minor of a bug. See attached patch. http://www.nntp.perl.org/group/perl.perl5.porters/2007/01/msg119615.html Perl Info
|
From @bulk880001-remove-intentional-leak-in-win32-win32.c-ansify_path.patchFrom c89db59250351a7219da1755e53a0eb12063e13d Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Mon, 19 May 2014 19:45:41 -0400
Subject: [PATCH] remove intentional leak in win32/win32.c ansify_path
The leak for was workaround for a bug (feature?) of Borland RTL where
putenv kept the passed in pointer, see commit 3e5d884e5e .
Borland was removed so this goes too. Leak found with Dr Memory.
msvcrt.dll from WinXP SP3 does not leak on a call to putenv, static linked
CRT from VC6 was confirmed to leak.
---
pod/perldelta.pod | 6 ++++++
win32/win32.c | 8 +-------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 828327a..5b181c9 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -2231,6 +2231,12 @@ enabled psuedo-fork in your build of Win32 Perl, and were running that build on
Server 2003 R2 or newer OS. The leak does not appear on WinXP SP3.
[L<perl #121676|https://rt.perl.org/Public/Bug/Display.html?id=121676>]
+=item *
+
+A small previously intentional memory leak in PERL_SYS_INIT/PERL_SYS_INIT3 on
+Win32 builds was fixed. This might affect embedders who repeatedly create and
+destroy perl engines within the same process.
+
=back
=item WinCE
diff --git a/win32/win32.c b/win32/win32.c
index f0db17b..cd594ca 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4356,13 +4356,7 @@ ansify_path(void)
* will not call mg_set() if it initializes %ENV from `environ`.
*/
SetEnvironmentVariableA("PATH", ansi_path+5);
- /* We are intentionally leaking the ansi_path string here because
- * the some runtime libraries puts it directly into the environ
- * array. The Microsoft runtime library seems to make a copy,
- * but will leak the copy should it be replaced again later.
- * Since this code is only called once during PERL_SYS_INIT this
- * shouldn't really matter.
- */
+ win32_free(ansi_path);
}
win32_free(wide_path);
}
--
1.7.9.msysgit.0
|
From @tonycozOn Mon May 19 16:57:10 2014, bulk88 wrote:
Thanks, applied as 0c2c57a. Tony |
The RT System itself - Status changed from 'new' to 'open' |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#121922 (status was 'resolved')
Searchable as RT121922$
The text was updated successfully, but these errors were encountered: