Text   |  XML   |  ReML   |   Visible Warnings:

Leak  at mailbox-list-index-sync.c:841

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

mailbox_list_index_sync_write

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-index/mailbox-list-index-sync.c)expand/collapse
Show more  
 834  mailbox_list_index_sync_write(struct mailbox_list_index_sync_ctx *ctx)
 835  {
 836          struct mailbox_list_index_header *hdr;
 837          bool partial;
 838          int ret = 0;
 839   
 840          if (ctx->index->mmap_base == NULL) {
 841[+]                 ctx->output = o_stream_create_fd_file(ctx->index->fd, 0, FALSE);
expand/collapse

o_stream_create_fd_file

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/ostream-file.c)expand/collapse
Show more  
 903  struct ostream *
 904  o_stream_create_fd_file(int fd, uoff_t offset, bool autoclose_fd)
 905  {
 906          struct file_ostream *fstream;
 907          struct ostream *ostream;
 908   
 909          if (offset == (uoff_t)-1)
 910                  offset = lseek(fd, 0, SEEK_CUR);
 911   
 912[+]         fstream = o_stream_create_fd_common(fd, autoclose_fd);
expand/collapse

o_stream_create_fd_common

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/ostream-file.c)expand/collapse
Show more  
 827  static struct file_ostream *
 828  o_stream_create_fd_common(int fd, bool autoclose_fd)
 829  {
 830          struct file_ostream *fstream;
 831   
 832[+]         fstream = i_new(struct file_ostream, 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  
 833          fstream->fd = fd;
 834          fstream->autoclose_fd = autoclose_fd;
 835          fstream->optimal_block_size = DEFAULT_OPTIMAL_BLOCK_SIZE;
 836   
 837          fstream->ostream.iostream.close = o_stream_file_close;
 838          fstream->ostream.iostream.destroy = o_stream_file_destroy;
 839          fstream->ostream.iostream.set_max_buffer_size =
 840                  o_stream_file_set_max_buffer_size;
 841   
 842          fstream->ostream.cork = o_stream_file_cork;
 843          fstream->ostream.flush = o_stream_file_flush;
 844          fstream->ostream.flush_pending = o_stream_file_flush_pending;
 845          fstream->ostream.get_used_size = o_stream_file_get_used_size;
 846          fstream->ostream.seek = o_stream_file_seek;
 847          fstream->ostream.sendv = o_stream_file_sendv;
 848          fstream->ostream.send_istream = o_stream_file_send_istream;
 849   
 850          return fstream;
Show more  
 913[+]         fstream_init_file(fstream);
 914          fstream->max_buffer_size = fstream->optimal_block_size;
 915          fstream->real_offset = offset;
 916          fstream->buffer_offset = offset;
 917   
 918[+]         ostream = o_stream_create(&fstream->ostream);
 919          ostream->offset = offset;
 920          return ostream;
Show more  
 842                  ctx->output_buf = buffer_create_dynamic(default_pool, 4096);
 843[+]                 o_stream_seek(ctx->output, ctx->hdr.used_space);
 844          }
 845   
 846          if (ctx->sync_root == ctx->root) {
 847                  ctx->seen_sync_root = TRUE;
 848                  partial = (ctx->flags & MAILBOX_LIST_SYNC_FLAG_PARTIAL) != 0;
 849          } else {
 850                  /* until we've seen the sync root, we're doing only partial 
 851                     syncing */
 852                  partial = TRUE;
 853          }
 854   
 855[+]         if (mailbox_list_index_sync_write_dir(ctx, ctx->root, 0, partial) < 0)
expand/collapse

mailbox_list_index_sync_write_dir

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-index/mailbox-list-index-sync.c)expand/collapse
Show more  
 755  mailbox_list_index_sync_write_dir(struct mailbox_list_index_sync_ctx *ctx,
 756                                    struct mailbox_list_sync_dir *sync_dir,
 757                                    uint32_t offset_pos, bool partial)
 758  {
 759          const struct mailbox_list_dir_record *dir;
 760          const struct mailbox_list_record *recs;
 761          const struct mailbox_list_sync_record *sync_recs;
 762          uint32_t child_offset_pos;
 763          unsigned int i, j, count;
 764          int ret;
 765   
 766          if (!ctx->seen_sync_root && ctx->sync_root == sync_dir) {
 767                  i_assert(partial);
 768                  ctx->seen_sync_root = TRUE;
 769                  partial = (ctx->flags & MAILBOX_LIST_SYNC_FLAG_PARTIAL) != 0;
 770          }
 771   
 772          if (sync_dir->offset != 0) {
 773                  /* point to latest dir entry's next_offset */
 774                  offset_pos = sync_dir->offset +
 775                          offsetof(struct mailbox_list_dir_record, next_offset);
 776          }
 777   
 778          if (sync_dir->new_records_count > 0) {
 779                  /* need to recreate the dir record */
 780                  if (mailbox_list_index_sync_recreate_dir(ctx, sync_dir,
 781                                                           offset_pos,
 782                                                           partial) < 0)
 783                          return -1;
 784                  /* NOTE: index may have been remaped here */
 785          } else if (sync_dir->seen_records_count !=
 786                     array_count(&sync_dir->records) && !partial) {
 787                  /* just mark the records deleted */
 788                  T_BEGIN {
 789                          ret = mailbox_list_index_sync_update_dir(ctx, sync_dir);
 790                  } T_END;
 791                  if (ret < 0)
 792                          return -1;
 793          }
 794   
 795          if (!partial && (ctx->flags & MAILBOX_LIST_SYNC_FLAG_RECURSIVE) == 0) {
 796                  /* we're doing a full sync only for the root */
 797                  partial = TRUE;
 798          }
 799   
 800          /* update child mailboxes */
 801          sync_recs = array_get(&sync_dir->records, &count);
 802          if (count == 0)
 803                  return 0;
 804   
 805          i_assert(sync_dir->offset != 0 &&
 806                   sync_dir->offset < ctx->index->mmap_size);
 807          for (i = j = 0; i < count; i++) {
 808                  if (sync_recs[i].dir == NULL)
 809                          continue;
 810   
 811                  /* these may change after each sync_write_dir() call */
 812                  dir = CONST_PTR_OFFSET(ctx->index->const_mmap_base,
 813                                         sync_dir->offset);
 814                  recs = MAILBOX_LIST_RECORDS(dir);
 815   
 816                  /* child_offset_pos needs to point to record's dir_offset */
 817                  for (; j < dir->count; j++) {
 818                          if (recs[j].uid == sync_recs[i].uid)
 819                                  break;
 820                  }
 821                  i_assert(j < dir->count);
 822   
 823                  child_offset_pos = (const char *)&recs[j].dir_offset -
 824                          (const char *)ctx->index->const_mmap_base;
 825                  if (mailbox_list_index_sync_write_dir(ctx, sync_recs[i].dir,
 826                                                        child_offset_pos,
 827                                                        partial) < 0)
Show more  
Show more  




Change Warning 11631.24837 : Leak

Priority:
State:
Finding:
Owner:
Note: