Mercurial > dovecot > core-2.2
changeset 22497:c836d071d8a7
lib-storage: mail_storage_set_critical() - don't free old error_string too early
It may be used in one of the parameters.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 25 Aug 2017 18:02:44 +0300 |
parents | 2b48af58cbfe |
children | 9c8e13eb813c |
files | src/lib-storage/mail-storage.c |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-storage.c Wed Sep 13 00:28:38 2017 +0200 +++ b/src/lib-storage/mail-storage.c Fri Aug 25 18:02:44 2017 +0300 @@ -538,9 +538,11 @@ void mail_storage_set_critical(struct mail_storage *storage, const char *fmt, ...) { - char *old_error = storage->last_internal_error; + char *old_error = storage->error_string; + char *old_internal_error = storage->last_internal_error; va_list va; + storage->error_string = NULL; storage->last_internal_error = NULL; /* critical errors may contain sensitive data, so let user see only "Internal error" with a timestamp to make it @@ -553,9 +555,10 @@ storage->last_error_is_internal = TRUE; i_error("%s", storage->last_internal_error); - /* free the old_error only after the new error is generated, because - the old_error may be one of the parameters. */ + /* free the old_error and old_internal_error only after the new error + is generated, because they may be one of the parameters. */ i_free(old_error); + i_free(old_internal_error); } const char *mail_storage_get_last_internal_error(struct mail_storage *storage,