[Spice-devel] [PATCH spice-server 01/20] add a red_memslot_info_destroy function

Pavel Grunt pgrunt at redhat.com
Fri Nov 25 13:55:02 UTC 2016


I prefer commits where a symbol is introduced and used.
In this case the destroy function can be used in the qxl parsing test.

Ack with ^

Pavel

On Thu, 2016-11-24 at 17:38 +0000, Frediano Ziglio wrote:
> Allows to free RedMemSlotInfo structure
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/memslot.c | 10 ++++++++++
>  server/memslot.h |  1 +
>  2 files changed, 11 insertions(+)
> 
> diff --git a/server/memslot.c b/server/memslot.c
> index 75cb75f..fdcd023 100644
> --- a/server/memslot.c
> +++ b/server/memslot.c
> @@ -166,6 +166,16 @@ void memslot_info_init(RedMemSlotInfo *info,
>                                         (info->mem_slot_bits + info-
> >generation_bits));
>  }
>  
> +void 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 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/memslot.h b/server/memslot.h
> index 5046d0f..71f1210 100644
> --- a/server/memslot.h
> +++ b/server/memslot.h
> @@ -66,6 +66,7 @@ void memslot_info_init(RedMemSlotInfo *info,
>                         uint8_t generation_bits,
>                         uint8_t id_bits,
>                         uint8_t internal_groupslot_id);
> +void memslot_info_destroy(RedMemSlotInfo *info);
>  void 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);


More information about the Spice-devel mailing list