summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-09-12 16:29:33 +0000
committerIvan Zhakov <ivan@apache.org>2022-09-12 16:29:33 +0000
commit4238b825cec696a3406995038b1039886ce140f5 (patch)
tree441472f06e013361a0ac174b918884805541a5ff
parente92a8ccc12f3fdb2fe670f99ce6c2ac170e53db4 (diff)
downloadapr-4238b825cec696a3406995038b1039886ce140f5.tar.gz
On 1.7.x branch: Merge r1902111 from 1.8.x branch:
win32: Fix double free on exit when apr_app is used on Windows. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1904025 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES2
-rw-r--r--misc/win32/apr_app.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index f7eccf9cd..dc414894e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -73,6 +73,8 @@ Changes for APR 1.7.1
*) Fix attempt to free invalid memory on exit when apr_app is used
on Windows. [Ivan Zhakov]
+ *) Fix double free on exit when apr_app is used on Windows. [Ivan Zhakov]
+
Changes for APR 1.7.0
*) apr_dir_read: [Unix] Dropped the preference of the dirread_r() flavor
diff --git a/misc/win32/apr_app.c b/misc/win32/apr_app.c
index f1b6ce57c..4b1874f33 100644
--- a/misc/win32/apr_app.c
+++ b/misc/win32/apr_app.c
@@ -91,9 +91,11 @@ int wmain(int argc, const wchar_t **wargv, const wchar_t **wenv)
* Reset _wenviron for good measure.
*/
if (_wenviron) {
- wenv = _wenviron;
_wenviron = NULL;
- free((wchar_t **)wenv);
+
+ /* There is no need to free _wenviron because MSVCRT
+ * automatically free 'initial' environment block.
+ */
}
apr_app_init_complete = 1;