dovecot-2.2: stats: When freeing memory, make sure we don't cras...
dovecot at dovecot.org
dovecot at dovecot.org
Sun May 20 03:26:30 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/3980c025805c
changeset: 14386:3980c025805c
user: Timo Sirainen <tss at iki.fi>
date: Mon Mar 26 16:57:32 2012 +0300
description:
stats: When freeing memory, make sure we don't crash if some list gets empty.
diffstat:
src/stats/mail-command.c | 3 ++-
src/stats/mail-domain.c | 3 ++-
src/stats/mail-ip.c | 3 ++-
src/stats/mail-session.c | 3 ++-
src/stats/mail-user.c | 3 ++-
5 files changed, 10 insertions(+), 5 deletions(-)
diffs (65 lines):
diff -r 8897f32939b0 -r 3980c025805c src/stats/mail-command.c
--- a/src/stats/mail-command.c Mon Mar 26 16:23:18 2012 +0300
+++ b/src/stats/mail-command.c Mon Mar 26 16:57:32 2012 +0300
@@ -206,7 +206,8 @@
}
mail_command_free(stable_mail_commands_head);
- if (global_used_memory < stats_settings->memory_limit)
+ if (global_used_memory < stats_settings->memory_limit ||
+ stable_mail_commands_head == NULL)
break;
diff = ioloop_time - stable_mail_commands_head->last_update.tv_sec;
diff -r 8897f32939b0 -r 3980c025805c src/stats/mail-domain.c
--- a/src/stats/mail-domain.c Mon Mar 26 16:23:18 2012 +0300
+++ b/src/stats/mail-domain.c Mon Mar 26 16:57:32 2012 +0300
@@ -100,7 +100,8 @@
while (mail_domains_head != NULL && mail_domains_head->refcount == 0) {
mail_domain_free(mail_domains_head);
- if (global_used_memory < stats_settings->memory_limit)
+ if (global_used_memory < stats_settings->memory_limit ||
+ mail_domains_head == NULL)
break;
diff = ioloop_time - mail_domains_head->last_update.tv_sec;
diff -r 8897f32939b0 -r 3980c025805c src/stats/mail-ip.c
--- a/src/stats/mail-ip.c Mon Mar 26 16:23:18 2012 +0300
+++ b/src/stats/mail-ip.c Mon Mar 26 16:57:32 2012 +0300
@@ -96,7 +96,8 @@
while (mail_ips_head != NULL && mail_ips_head->refcount == 0) {
mail_ip_free(mail_ips_head);
- if (global_used_memory < stats_settings->memory_limit)
+ if (global_used_memory < stats_settings->memory_limit ||
+ mail_ips_head == NULL)
break;
diff = ioloop_time - mail_ips_head->last_update.tv_sec;
diff -r 8897f32939b0 -r 3980c025805c src/stats/mail-session.c
--- a/src/stats/mail-session.c Mon Mar 26 16:23:18 2012 +0300
+++ b/src/stats/mail-session.c Mon Mar 26 16:57:32 2012 +0300
@@ -277,7 +277,8 @@
i_assert(mail_sessions_head->disconnected);
mail_session_free(mail_sessions_head);
- if (global_used_memory < stats_settings->memory_limit)
+ if (global_used_memory < stats_settings->memory_limit ||
+ mail_sessions_head == NULL)
break;
diff = ioloop_time - mail_sessions_head->last_update.tv_sec;
diff -r 8897f32939b0 -r 3980c025805c src/stats/mail-user.c
--- a/src/stats/mail-user.c Mon Mar 26 16:23:18 2012 +0300
+++ b/src/stats/mail-user.c Mon Mar 26 16:57:32 2012 +0300
@@ -118,7 +118,8 @@
while (mail_users_head != NULL && mail_users_head->refcount == 0) {
mail_user_free(mail_users_head);
- if (global_used_memory < stats_settings->memory_limit)
+ if (global_used_memory < stats_settings->memory_limit ||
+ mail_users_head == NULL)
break;
diff = ioloop_time - mail_users_head->last_update.tv_sec;
More information about the dovecot-cvs
mailing list