]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
stats: Fixed crash when handling multiple users within same process.
authorTimo Sirainen <tss@iki.fi>
Wed, 28 Nov 2012 02:21:03 +0000 (04:21 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 28 Nov 2012 02:21:03 +0000 (04:21 +0200)
src/plugins/stats/stats-plugin.c

index 5362426bbd5c15fa0682f3e9033373ceb34d7328..1a1682c84e2b3a3098f4f37972456e643053a1af 100644 (file)
@@ -587,9 +587,13 @@ static void stats_user_created(struct mail_user *user)
                stats_global_user = user;
        } else if (stats_user_count == 1) {
                /* second user connection. we'll need to start doing
-                  per-io callback tracking now. */
-               stats_add_session(stats_global_user);
-               stats_global_user = NULL;
+                  per-io callback tracking now. (we might have been doing it
+                  also previously but just temporarily quickly dropped to
+                  having 1 user, in which case stats_global_user=NULL) */
+               if (stats_global_user != NULL) {
+                       stats_add_session(stats_global_user);
+                       stats_global_user = NULL;
+               }
        }
        stats_user_count++;