From: Timo Sirainen Date: Wed, 22 Feb 2017 13:29:34 +0000 (+0200) Subject: lib-storage: Allow mail_storage_set_error() to use existing error_string X-Git-Tag: 2.3.0.rc1~2004 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2fd3f13fff682498ad58fec7c11f20f9890c657;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Allow mail_storage_set_error() to use existing error_string Fixes some code that may be attempting to copy an error from one storage to another, but actually ends up trying to copy within the same storage. --- diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index c6e7393579..1a215f0e24 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -493,8 +493,10 @@ void mail_storage_clear_error(struct mail_storage *storage) void mail_storage_set_error(struct mail_storage *storage, enum mail_error error, const char *string) { - i_free(storage->error_string); - storage->error_string = i_strdup(string); + if (storage->error_string != string) { + i_free(storage->error_string); + storage->error_string = i_strdup(string); + } storage->error = error; }