From 57c0890f22c514395458ee87883ac47ce99ae100 Mon Sep 17 00:00:00 2001 From: Ivan Zhakov Date: Sun, 19 Jun 2022 11:16:15 +0000 Subject: 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 --- misc/win32/apr_app.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'misc') 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; -- cgit v1.2.1