Skip to content

Commit

Permalink
lib-storage: Fix mail_storage_last_error_push/pop() to work with inte…
Browse files Browse the repository at this point in the history
…rnal errors
  • Loading branch information
sirainen authored and villesavolainen committed May 26, 2017
1 parent f328c5f commit 4cb79ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib-storage/mail-storage-private.h
Expand Up @@ -105,6 +105,8 @@ struct mail_binary_cache {
struct mail_storage_error {
char *error_string;
enum mail_error error;
char *last_internal_error;
bool last_error_is_internal;
};

struct mail_storage {
Expand Down
6 changes: 6 additions & 0 deletions src/lib-storage/mail-storage.c
Expand Up @@ -657,6 +657,9 @@ void mail_storage_last_error_push(struct mail_storage *storage)
err = array_append_space(&storage->error_stack);
err->error_string = i_strdup(storage->error_string);
err->error = storage->error;
err->last_error_is_internal = storage->last_error_is_internal;
if (err->last_error_is_internal)
err->last_internal_error = i_strdup(storage->last_internal_error);
}

void mail_storage_last_error_pop(struct mail_storage *storage)
Expand All @@ -666,8 +669,11 @@ void mail_storage_last_error_pop(struct mail_storage *storage)
array_idx(&storage->error_stack, count-1);

i_free(storage->error_string);
i_free(storage->last_internal_error);
storage->error_string = err->error_string;
storage->error = err->error;
storage->last_error_is_internal = err->last_error_is_internal;
storage->last_internal_error = err->last_internal_error;
array_delete(&storage->error_stack, count-1, 1);
}

Expand Down

0 comments on commit 4cb79ce

Please sign in to comment.