From: John Wolfe Date: Wed, 19 Aug 2020 17:01:16 +0000 (-0700) Subject: Free old ununsed loggers when tools.conf changes. X-Git-Tag: stable-11.1.5~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ede22ec6f00ee132651cbf4334fecb2366c01aa;p=thirdparty%2Fopen-vm-tools.git Free old ununsed loggers when tools.conf changes. Existing unused loggers are leaked when there is a change in logging configuration. Added a check to free the loggers that are not used after tools.conf is modified. --- diff --git a/open-vm-tools/libvmtools/vmtoolsLog.c b/open-vm-tools/libvmtools/vmtoolsLog.c index 3c331b5a8..6b8154408 100644 --- a/open-vm-tools/libvmtools/vmtoolsLog.c +++ b/open-vm-tools/libvmtools/vmtoolsLog.c @@ -1512,8 +1512,17 @@ VMToolsConfigLoggingInt(const gchar *defaultDomain, /* If needed, restore the old configuration. */ if (!reset) { if (oldDomains != NULL) { + guint i; + for (i = 0; i < oldDomains->len; i++) { + LogHandler *old = g_ptr_array_index(oldDomains, i); + CLEAR_LOG_HANDLER(old); + } g_ptr_array_free(oldDomains, TRUE); } + if (oldDefault != NULL && oldDefault != gDefaultData) { + CLEAR_LOG_HANDLER(oldDefault); + oldDefault = NULL; + } } /*