changeset 21694:310994917431

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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 22 Feb 2017 15:29:34 +0200
parents c00c65eb641a
children 302c931ee755
files src/lib-storage/mail-storage.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-storage.c	Tue Nov 01 18:43:57 2016 +0200
+++ b/src/lib-storage/mail-storage.c	Wed Feb 22 15:29:34 2017 +0200
@@ -493,8 +493,10 @@
 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;
 }