]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Free old ununsed loggers when tools.conf changes.
authorJohn Wolfe <jwolfe@vmware.com>
Wed, 19 Aug 2020 17:01:16 +0000 (10:01 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Wed, 19 Aug 2020 17:01:16 +0000 (10:01 -0700)
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.

open-vm-tools/libvmtools/vmtoolsLog.c

index 3c331b5a820ff0d0809e6cab00edec793c9c5f6c..6b8154408ac27c0271f2c18eba3cd7ad9ea8b7a5 100644 (file)
@@ -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;
+      }
    }
 
    /*