[Spice-devel] [PATCH 2/7] add a red_memslot_info_destroy function
Frediano Ziglio
fziglio at redhat.com
Wed Oct 14 08:37:31 PDT 2015
Allows to free RedMemSlotInfo structure
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/red_memslots.c | 10 ++++++++++
server/red_memslots.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/server/red_memslots.c b/server/red_memslots.c
index 1b3ec62..b77b4b4 100644
--- a/server/red_memslots.c
+++ b/server/red_memslots.c
@@ -153,6 +153,16 @@ void red_memslot_info_init(RedMemSlotInfo *info,
(info->mem_slot_bits + info->generation_bits));
}
+void red_memslot_info_destroy(RedMemSlotInfo *info)
+{
+ uint32_t i;
+
+ for (i = 0; i < info->num_memslots_groups; ++i) {
+ free(info->mem_slots[i]);
+ }
+ free(info->mem_slots);
+}
+
void red_memslot_info_add_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id,
uint64_t addr_delta, unsigned long virt_start, unsigned long virt_end,
uint32_t generation)
diff --git a/server/red_memslots.h b/server/red_memslots.h
index 27443a6..4f725be 100644
--- a/server/red_memslots.h
+++ b/server/red_memslots.h
@@ -63,6 +63,7 @@ void red_memslot_info_init(RedMemSlotInfo *info,
uint8_t generation_bits,
uint8_t id_bits,
uint8_t internal_groupslot_id);
+void red_memslot_info_destroy(RedMemSlotInfo *info);
void red_memslot_info_add_slot(RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id,
uint64_t addr_delta, unsigned long virt_start, unsigned long virt_end,
uint32_t generation);
--
2.4.3
More information about the Spice-devel
mailing list