From b082ce9638a2609bc942a1a5757f79cde70c6ae8 Mon Sep 17 00:00:00 2001 From: btharper Date: Tue, 19 Mar 2019 13:13:15 -0400 Subject: [PATCH] Fix leak when updating search path in config --- Python/coreconfig.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Python/coreconfig.c b/Python/coreconfig.c index 08273765098e07..9256bac18cc810 100644 --- a/Python/coreconfig.c +++ b/Python/coreconfig.c @@ -967,6 +967,9 @@ config_read_env_vars(_PyCoreConfig *config) if (res < 0) { return DECODE_LOCALE_ERR("PYTHONPATH", res); } + if (config->module_search_path_env != NULL) { + PyMem_RawFree(config->module_search_path_env); + } config->module_search_path_env = path; if (config->use_hash_seed < 0) {