From: Oliver Kurth Date: Tue, 21 Apr 2020 21:43:46 +0000 (-0700) Subject: Free old ununsed loggers when tools.conf changes. X-Git-Tag: stable-11.2.0~242 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e2e15a2da54f3603a7ccdc09249aec0b58f6ed9;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; + } } /*