]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Allow mail_storage_set_error() to use existing error_string
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 22 Feb 2017 13:29:34 +0000 (15:29 +0200)
committerGitLab <gitlab@git.dovecot.net>
Wed, 22 Feb 2017 22:44:27 +0000 (00:44 +0200)
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.

src/lib-storage/mail-storage.c

index c6e7393579db5ae628bc19d64aceb6be97108593..1a215f0e249eb63ab15485fa5b9ec38d9cc2a8fd 100644 (file)
@@ -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;
 }