summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-06-19 11:16:15 +0000
committerIvan Zhakov <ivan@apache.org>2022-06-19 11:16:15 +0000
commit57c0890f22c514395458ee87883ac47ce99ae100 (patch)
tree148d9bcf24ca73dbd15dd230a9eeb57adcf6d004
parent1f1386f286001ed636f0cafcaf37427eca2072ec (diff)
downloadapr-57c0890f22c514395458ee87883ac47ce99ae100.tar.gz
win32: Fix double free on exit when apr_app is used on Windows. [Ivan Zhakov]
* CHANGES: Add changelog entry. * misc/win32/apr_app.c (wmain): Do not free _wenviron -- MSVCRT automatically free 'initial' environment block on exit. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902059 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 6547300bf..332d60327 100644
--- a/CHANGES
+++ b/CHANGES
@@ -264,6 +264,8 @@ Changes for APR 2.0.0
*) 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 and APR-util 1.7.x and later:
*) http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/CHANGES?view=markup
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;