qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 03/37] qga: free the whole blacklist


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 03/37] qga: free the whole blacklist
Date: Tue, 19 Jul 2016 12:22:52 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 07/19/2016 02:53 AM, address@hidden wrote:
> From: Marc-André Lureau <address@hidden>
> 
> Free the list, not just the elements.
> 
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  qga/main.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/qga/main.c b/qga/main.c
> index 4c3b2c7..bb48214 100644
> --- a/qga/main.c
> +++ b/qga/main.c
> @@ -1175,6 +1175,7 @@ static void config_free(GAConfig *config)
>  #ifdef CONFIG_FSFREEZE
>      g_free(config->fsfreeze_hook);
>  #endif
> +    g_list_free_full(config->blacklist, g_free);
>      g_free(config);

Won't work. We still allow glib 2.22, but g_list_free_full() was added
in 2.28. See also commit ba4dba5, where I had to open-code around the
lack of the relative g_queue_free_full().

You can, of course, do a prereq patch that supplies fallbacks for older
glib, but it may be easiest to just open-code the additional step of
g_list_free(config->blacklist)...

> @@ -1310,11 +1311,6 @@ static int run_agent(GAState *s, GAConfig *config)
>      return EXIT_SUCCESS;
>  }
>  
> -static void free_blacklist_entry(gpointer entry, gpointer unused)
> -{
> -    g_free(entry);
> -}
> -
>  int main(int argc, char **argv)
>  {
>      int ret = EXIT_SUCCESS;
> @@ -1379,7 +1375,6 @@ end:
>      if (s->channel) {
>          ga_channel_free(s->channel);
>      }
> -    g_list_foreach(config->blacklist, free_blacklist_entry, NULL);

...right here, without deleting any of the existing code.


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]