Text   |  XML   |  ReML   |   Visible Warnings:

Uninitialized Variable  at ostream.c:20

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

dbox_sync_file_expunge

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/dbox/dbox-sync-file.c)expand/collapse
Show more  
 87  dbox_sync_file_expunge(struct dbox_sync_context *ctx, struct dbox_file *file,
 88                         const struct dbox_sync_file_entry *entry)
 89  {
 90          const struct seq_range *expunges;
 91          struct dbox_file *out_file = NULL;
 92          struct istream *input;
 93          struct ostream *output;
 94          uint32_t file_id, seq, uid;
 95          uoff_t first_offset, offset, physical_size;
 96          const char *out_path;
 97          unsigned int i, count;
 98          bool expunged;
 99          int ret;
 100   
 101          expunges = array_get(&entry->expunges, &count);
 102          if (!dbox_file_lookup(ctx->mbox, ctx->sync_view, expunges[0].seq1,
 103[+]                               &file_id, &first_offset))
 104                  return 0;
 105          i_assert(file_id == file->file_id);
 106          mail_index_expunge(ctx->trans, expunges[0].seq1);
 107   
 108          offset = first_offset;
 109          for (i = 0;;) {
 110                  if ((ret = dbox_file_seek_next(file, &offset, &uid,
 111                                                 &physical_size)) <= 0)
 112                          break;
 113                  if (uid == 0) {
 114                          /* EOF */
 115                          break;
 116                  }
 117   
 118                  if (i < count) {
 119                          mail_index_lookup_seq(ctx->sync_view, uid, &seq);
 120                          while (seq > expunges[i].seq2) {
 121                                  if (++i == count)
 122                                          break;
 123                          }
 124                  }
 125                  if (seq == 0 || (i < count && seq >= expunges[i].seq1 &&
 126                                   seq <= expunges[i].seq2)) {
 127                          /* this message gets expunged */
 128                          if (seq != 0)
 129                                  mail_index_expunge(ctx->trans, seq);
 130                          continue;
 131                  }
 132   
 133                  /* non-expunged message. write it to output file. */
 134                  if (out_file == NULL) {
 135[+]                         out_file = dbox_file_init(ctx->mbox, 0);
 136                          ret = dbox_file_get_append_stream(out_file,
 137                                                            physical_size,
 138[+]                                                           &output);
 139                          if (ret <= 0)
 140                                  break;
 141                  }
 142   
 143                  i_stream_seek(file->input, offset);
 144                  input = i_stream_create_limit(file->input,
 145                                                file->msg_header_size +
 146                                                physical_size);
 147                  ret = o_stream_send_istream(output, input) < 0 ? -1 : 0;
 148                  i_stream_unref(&input);
 149                  if (ret < 0)
 150                          break;
 151   
 152                  /* write  */
 153                  (void)(file, offset,
 154                                                            &expunged);
 155                  T_BEGIN {
 156                          (ctx, file, entry, seq);
 157                  } T_END;
 158                  if ((ret = (file, output)) < 0)
 159                          break;
 160   
 161                  mail_index_update_flags(ctx->trans, seq, MODIFY_REMOVE,
 162                          (enum mail_flags)MAIL_INDEX_MAIL_FLAG_DIRTY);
 163          }
 164   
 165          out_path = out_file == NULL ? NULL :
 166                  dbox_file_get_path(out_file);
 167          if (ret <= 0) {
 168                  if (out_file != NULL) {
 169                          if (unlink(out_path) < 0)
 170                                  i_error("unlink(%s) failed: %m", out_path);
 171[+]                         o_stream_unref(&output);
expand/collapse

o_stream_unref

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/ostream.c)expand/collapse
Show more  
 18  void o_stream_unref(struct ostream **stream)
 19  {
 20          io_stream_unref(&(*stream)->real_stream->iostream);
Show more  
Show more  




Change Warning 7470.25702 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: