[Dovecot] suspect valgrind error in mail-index-map.c

Diego Liziero diegoliz at gmail.com
Sat Mar 8 18:26:38 EET 2008


Hi

At line 1118 of src//lib-index/mail-index-map.c, inside the function
mail_index_map_move_to_memory, there is:
mail_index_map_copy_header(map, map);

Valgrind is stating that "Source and destination overlap in memcpy".
I'm wondering if this code is just coping the same memory over itself,
or if it is doing something useful.

Regards,
Diego Liziero.
---
1104 void mail_index_map_move_to_memory(struct mail_index_map *map)
1105 {
1106 	struct mail_index_record_map *new_map;
1107
1108 	if (map->rec_map->mmap_base == NULL)
1109 		return;
1110
1111 	i_assert(map->rec_map->lock_id != 0);
1112
1113 	new_map = array_count(&map->rec_map->maps) == 1 ? map->rec_map :
1114 		mail_index_record_map_alloc(map);
1115
1116 	mail_index_map_copy_records(new_map, map->rec_map,
1117 				    map->hdr.record_size);
1118 	mail_index_map_copy_header(map, map);
1119
1120 	if (new_map != map->rec_map) {
1121 		mail_index_record_map_unlink(map);
1122 		map->rec_map = new_map;
1123 	} else {
1124 		mail_index_unlock(map->index, &new_map->lock_id);
1125 		if (munmap(new_map->mmap_base, new_map->mmap_size) < 0)
1126 			mail_index_set_syscall_error(map->index, "munmap()");
1127 		new_map->mmap_base = NULL;
1128 	}
1129 }


More information about the dovecot mailing list