Text   |  XML   |  ReML   |   Visible Warnings:

Leak  at dbox-sync-file.c:434

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

dbox_sync_file

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/dbox/dbox-sync-file.c)expand/collapse
Show more  
 410  int dbox_sync_file(struct dbox_sync_context *ctx,
 411                     const struct dbox_sync_file_entry *entry)
 412  {
 413          struct dbox_file *file;
 414          struct dbox_index_record *rec;
 415          enum dbox_index_file_status status;
 416          bool locked, deleted;
 417          int ret;
 418   
 419          if ((entry->file_id & DBOX_FILE_ID_FLAG_UID) != 0) {
 420                  locked = TRUE;
 421                  status = DBOX_INDEX_FILE_STATUS_SINGLE_MESSAGE;
 422          } else {
 423                  rec = dbox_index_record_lookup(ctx->mbox->dbox_index,
 424                                                 entry->file_id);
 425                  if (rec == NULL ||
 426                      rec->status == DBOX_INDEX_FILE_STATUS_UNLINKED) {
 427                          /* file doesn't exist, nothing to do */
 428                          return 1;
 429                  }
 430                  locked = rec->locked;
 431                  status = rec->status;
 432          }
 433   
 434[+]         file = dbox_file_init(ctx->mbox, entry->file_id);
expand/collapse

dbox_file_init

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/dbox/dbox-file.c)expand/collapse
Show more  
 154  struct dbox_file *
 155  dbox_file_init(struct dbox_mailbox *mbox, unsigned int file_id)
 156  {
 157          struct dbox_file *file;
 158          unsigned int count;
 159          bool maildir;
 160   
 161          file = file_id == 0 ? NULL :
 162                  dbox_find_and_move_open_file(mbox, file_id);
 163          if (file != NULL) {
 164                  file->refcount++;
 165                  return file;
 166          }
 167   
 168          count = array_count(&mbox->open_files);
 169          if (count > mbox->max_open_files)
 170                  dbox_close_open_files(mbox, count - mbox->max_open_files);
 171   
 172[+]         file = i_new(struct dbox_file, 1);
expand/collapse

i_malloc

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/imem.c)expand/collapse
Show more  
 7  void *i_malloc(size_t size)
 8  {
 9      void *rv = malloc(size);
 10      if( !rv )
 11          abort();
 12      return rv;
Show more  
 173          file->refcount = 1;
 174          file->mbox = mbox;
 175          if (file_id != 0) {
 176                  file->file_id = file_id;
 177                  file->fname = dbox_file_id_get_fname(mbox, file_id, &maildir);
 178                  file->maildir_file = maildir;
 179          } else {
 180                  file->fname = dbox_generate_tmp_filename();
 181          }
 182          if (file->maildir_file || file_id == 0) {
 183                  /* newly created files and maildir files always exist in the
 184                     primary path */
 185                  file->current_path =
 186                          i_strdup_printf("%s/%s", mbox->path, file->fname);
 187          }
 188          file->fd = -1;
 189   
 190          if (file_id != 0)
 191                  array_append(&file->mbox->open_files, &file, 1);
 192          return file;
Show more  
 435          if ((status == DBOX_INDEX_FILE_STATUS_SINGLE_MESSAGE ||
 436               status == DBOX_INDEX_FILE_STATUS_MAILDIR) &&
 437              array_is_created(&entry->expunges)) {
 438                  /* fast path to expunging the whole file */
 439[+]                 if (dbox_sync_file_unlink(file) < 0)
 440                          ret = -1;
 441                  else {
 442                          dbox_sync_mark_single_file_expunged(ctx, entry);
 443                          ret = 1;
 444                  }
 445          } else {
 446                  ret = dbox_file_open_or_create(file, TRUE, &deleted);
 447                  if (ret > 0 && !deleted) {
 448                          dbox_sync_file_move_if_needed(ctx, file, entry);
 449                          ret = dbox_sync_file_int(ctx, file, entry, locked);
 450                  }
 451          }
 452[+]         dbox_file_unref(&file);
expand/collapse

dbox_file_unref

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/dbox/dbox-file.c)expand/collapse
Show more  
 240  void dbox_file_unref(struct dbox_file **_file)
 241  {
 242          struct dbox_file *file = *_file;
 243          struct dbox_file *const *files;
 244          unsigned int i, count;
 245   
 246          *_file = NULL;
 247   
 248          i_assert(file->refcount > 0);
 249          if (--file->refcount > 0)
 250                  return;
 251   
 252          /* don't cache  seeks while file isn't being referenced */
 253          file-> = 0;
 254   
 255          if (file->file_id != 0) {
 256                  files = array_get(&file->mbox->open_files, &count);
 257                  if (!file->deleted && count <= file->mbox->max_open_files) {
 258                          /* we can leave this file open for now */
 259                          return;
Show more  
Show more  




Change Warning 11694.25789 : Leak

Priority:
State:
Finding:
Owner:
Note: