Text   |  XML   |  ReML   |   Visible Warnings:

Leak  at dbox-index.c:710

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

dbox_index_append_file_record

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/dbox/dbox-index.c)expand/collapse
Show more  
 681  dbox_index_append_file_record(struct dbox_index_append_context *ctx,
 682                                struct dbox_index_record *record,
 683                                uoff_t mail_size, struct dbox_file **file_r,
 684                                struct ostream **output_r)
 685  {
 686          struct dbox_file *const *files, *file;
 687          enum dbox_index_file_lock_status lock_status;
 688          unsigned int i, count;
 689   
 690          if (record->status != DBOX_INDEX_FILE_STATUS_APPENDABLE)
 691                  return FALSE;
 692   
 693          if (record->expunges)
 694                  return FALSE;
 695   
 696          /* if we already have it in our files list, we already checked that
 697             we can't append to it. */
 698          files = array_get(&ctx->files, &count);
 699          for (i = 0; i < count; i++) {
 700                  if (files[i]->file_id == record->file_id)
 701                          return FALSE;
 702          }
 703          i_assert(!record->locked);
 704   
 705          if (dbox_index_try_lock_file(ctx->index, record->file_id,
 706                                       &lock_status) <= 0)
 707                  return FALSE;
 708   
 709          /* open the file to see if we can append */
 710[+]         file = dbox_file_init(ctx->index->mbox, record->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  
 711[+]         if (dbox_file_get_append_stream(file, mail_size, output_r) <= 0) {
 712                  dbox_index_unlock_file(ctx->index, record->file_id);
 713[+]                 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 11684.25575 : Leak

Priority:
State:
Finding:
Owner:
Note: