[Libguestfs] [PATCH] properly initialize error_data_lock_list before use

Richard W.M. Jones rjones at redhat.com
Thu Feb 6 13:24:25 UTC 2020


On Tue, Feb 04, 2020 at 08:32:11PM -0500, Daria Phoebe Brashear wrote:
> Required such that macOS doesn't crash in get_error_data (via call stack
> from guestfs_launch)
> 
> >From 5b121bc8bb8f1fadf835b4af30cbb9c9e95af258 Mon Sep 17 00:00:00 2001
> From: Daria Phoebe Brashear <dariaphoebe at auristor.com>
> Date: Tue, 4 Feb 2020 20:25:10 -0500
> Subject: [PATCH] libhandle: initialize error_data_list_lock
> 
> when a handle is allocated, the error_data_list_lock must be initialized
> ---
>  lib/handle.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/handle.c b/lib/handle.c
> index f61fdbcd3..99a8b8848 100644
> --- a/lib/handle.c
> +++ b/lib/handle.c
> @@ -88,6 +88,7 @@ guestfs_create_flags (unsigned flags, ...)
>    if (!g) return NULL;
> 
>    gl_recursive_lock_init (g->lock);
> +  gl_lock_init (g->error_data_list_lock);
> 
>    g->state = CONFIG;
> 
> @@ -176,6 +177,7 @@ guestfs_create_flags (unsigned flags, ...)
>    free (g->append);
>    guestfs_int_free_error_data_list (g);
>    gl_tls_key_destroy (g->error_data);
> +  gl_lock_destroy (g->error_data_list_lock);
>    gl_recursive_lock_destroy (g->lock);
>    free (g);
>    return NULL;

Thanks - applied and pushed.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list