Skip to content

Commit

Permalink
lib-storage: Once hooks have run, set vlast to NULL to make sure it's…
Browse files Browse the repository at this point in the history
… not used

The functions can't be correctly overridden outside their own specific
hooks. It would work only if hook_build_update() is called afterwards and
currently there's no public API for that.
  • Loading branch information
sirainen committed Feb 4, 2017
1 parent 7954017 commit 24ffb6a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib-storage/mail-storage-hooks.c
Expand Up @@ -273,6 +273,7 @@ void hook_mail_user_created(struct mail_user *user)
hook_build_update(ctx, user->vlast);
} T_END;
}
user->vlast = NULL;
pool_unref(&ctx->pool);
}

Expand Down Expand Up @@ -326,6 +327,7 @@ void hook_mail_storage_created(struct mail_storage *storage)
hook_build_update(ctx, storage->vlast);
} T_END;
}
storage->vlast = NULL;
pool_unref(&ctx->pool);
}

Expand All @@ -342,6 +344,7 @@ void hook_mailbox_list_created(struct mailbox_list *list)
hook_build_update(ctx, list->vlast);
} T_END;
}
list->vlast = NULL;
pool_unref(&ctx->pool);
}

Expand All @@ -358,6 +361,7 @@ void hook_mailbox_allocated(struct mailbox *box)
hook_build_update(ctx, box->vlast);
} T_END;
}
box->vlast = NULL;
pool_unref(&ctx->pool);
}

Expand Down Expand Up @@ -386,5 +390,6 @@ void hook_mail_allocated(struct mail *mail)
hook_build_update(ctx, pmail->vlast);
} T_END;
}
pmail->vlast = NULL;
pool_unref(&ctx->pool);
}

0 comments on commit 24ffb6a

Please sign in to comment.