Text   |  XML   |  ReML   |   Visible Warnings:

Free Null Pointer  at virtual-sync.c:1122

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

virtual_sync_backend_map_uids

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/virtual/virtual-sync.c)expand/collapse
Show more  
 1047  static void virtual_sync_backend_map_uids(struct virtual_sync_context *ctx)
 1048  {
 1049          uint32_t virtual_ext_id = ctx->mbox->virtual_ext_id;
 1050          struct virtual_sync_mail *vmails;
 1051          struct virtual_backend_box *bbox, *const *bboxes;
 1052          struct virtual_backend_uidmap *uidmap = NULL;
 1053          struct virtual_add_record add_rec;
 1054          const struct virtual_mail_index_record *vrec;
 1055          const void *data;
 1056          bool expunged;
 1057          uint32_t i, vseq, vuid, messages, count;
 1058          unsigned int j = 0, uidmap_count = 0;
 1059   
 1060          messages = mail_index_view_get_messages_count(ctx->sync_view);
 1061   
 1062          /* sort the messages in current view by their backend mailbox and 
 1063             real UID */
 1064          vmails = messages == 0 ? NULL :
 1065                  i_new(struct virtual_sync_mail, messages);
 1066          for (vseq = 1; vseq <= messages; vseq++) {
 1067                  mail_index_lookup_ext(ctx->sync_view, vseq, virtual_ext_id,
 1068                                        &data, &expunged);
 1069                  vrec = data;
 1070                  vmails[vseq-1].vseq = vseq;
 1071                  vmails[vseq-1].vrec = *vrec;
 1072          }
 1073          qsort(vmails, messages, sizeof(*vmails), virtual_sync_mail_cmp);
 1074   
 1075          /* create real mailbox uid -> virtual uid mapping and expunge 
 1076             messages no longer matching the search rule */
 1077          memset(&add_rec, 0, sizeof(add_rec));
 1078          bbox = NULL;
 1079          for (i = 0; i < messages; i++) {
 1080                  vseq = vmails[i].vseq;
 1081                  vrec = &vmails[i].vrec;
 1082   
 1083                  if (bbox == NULL || bbox->mailbox_id != vrec->mailbox_id) {
 1084                          /* add the rest of the newly seen messages */
 1085                          for (; j < uidmap_count; j++) {
 1086                                  add_rec.rec.real_uid = uidmap[j].real_uid;
 1087                                  array_append(&ctx->all_adds, &add_rec, 1);
 1088                          }
 1089                          bbox = virtual_backend_box_lookup(ctx->mbox,
 1090
1111
Show [ Lines 1090 to 1111 omitted. ]
 1112                  }
 1113                  if (j == uidmap_count || uidmap[j].real_uid != vrec->real_uid)
 1114                          mail_index_expunge(ctx->trans, vseq);
 1115                  else {
 1116                          /* exists - update uidmap and flags */
 1117                          uidmap[j++].virtual_uid = vuid;
 1118                          virtual_sync_external_flags(ctx, bbox, vseq,
 1119                                                      vrec->real_uid);
 1120                  }
 1121          }
 1122          i_free(vmails);
Show more  




Change Warning 11501.24712 : Free Null Pointer

Priority:
State:
Finding:
Owner:
Note: