[dovecot-cvs] dovecot/src/lib-index mail-transaction-log.c, 1.128, 1.129
tss at dovecot.org
tss at dovecot.org
Fri Mar 16 17:45:03 EET 2007
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv2810
Modified Files:
mail-transaction-log.c
Log Message:
Creating initial transaction log file leaked memory, created the file
twice and caused potential locking problems.
Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- mail-transaction-log.c 15 Mar 2007 01:05:17 -0000 1.128
+++ mail-transaction-log.c 16 Mar 2007 15:44:59 -0000 1.129
@@ -38,6 +38,9 @@
bool lock, dev_t dev, ino_t ino,
uoff_t file_size);
static int
+mail_transaction_log_file_fd_open_or_create(struct mail_transaction_log_file
+ *file, bool try_retry);
+static int
mail_transaction_log_file_read(struct mail_transaction_log_file *file,
uoff_t offset);
@@ -305,7 +308,9 @@
memset(&st, 0, sizeof(st));
if (mail_transaction_log_file_create(file, FALSE,
st.st_dev, st.st_ino,
- st.st_size) < 0) {
+ st.st_size) < 0 ||
+ mail_transaction_log_file_fd_open_or_create(file,
+ FALSE) < 0) {
mail_transaction_log_file_free(file);
file = NULL;
}
@@ -324,6 +329,7 @@
}
file->refcount++;
log->head = file;
+ i_assert(log->files != NULL);
if (index->fd != -1 &&
INDEX_HAS_MISSING_LOGS(index, log->head)) {
@@ -953,6 +959,7 @@
mail_transaction_log_file_unlock(log->head);
i_assert(log->head != file);
+ i_assert(log->files != NULL);
log->head = file;
log->head->refcount++;
return 0;
@@ -998,6 +1005,7 @@
if (--log->head->refcount == 0)
mail_transaction_logs_clean(log);
+ i_assert(log->files != NULL);
log->head = file;
log->head->refcount++;
return 0;
More information about the dovecot-cvs
mailing list