- /* if we have reached our current mapping limit, expand it */
- if (mmap_infos_cur == mmap_infos_max) {
- struct mmap_info *realloc_mmap_infos = NULL;
-
- mmap_infos_max += NEW_MMAP_STRUCT_CNT;
- realloc_mmap_infos = (struct mmap_info *) realloc(mmap_infos,
- mmap_infos_max * sizeof(struct mmap_info));
- if (realloc_mmap_infos == NULL) {
- mmap_infos_max -= NEW_MMAP_STRUCT_CNT;
- goto error_mutex_unlock;
- }
- mmap_infos = realloc_mmap_infos;
- }
-
- /* Add the new mapping to the array */
- memcpy(&mmap_infos[mmap_infos_cur], &mapping,
- sizeof(struct mmap_info));
- mmap_infos_cur++;
+ /* Add the new mapping to the hashtable. */
+ g_hash_table_insert(mmap_mappings, mapping_addr, mapping);