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

Re: [libvirt] [PATCH] Avoid segv if ncf_init fails



On Fri, Oct 23, 2009 at 03:13:17PM -0400, Laine Stump wrote:
> If ncf_init() fails, it takes responsibility to call ncf_close() when
> appropriate. Having libvirt call it results in a double close, which
> ends up segv'ing.

Hmm, it would be good if ncf_init  set the passed in pointer to NULL
when it failed, then your existing cleanup check would have been
safe.

> ---
>  src/interface/netcf_driver.c |    4 ----
>  1 files changed, 0 insertions(+), 4 deletions(-)
> 
> diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
> index b5c3664..c44ba62 100644
> --- a/src/interface/netcf_driver.c
> +++ b/src/interface/netcf_driver.c
> @@ -142,10 +142,6 @@ static virDrvOpenStatus interfaceOpenInterface(virConnectPtr conn,
>      return 0;
>  
>  netcf_error:
> -    if (driverState->netcf)
> -    {
> -        ncf_close(driverState->netcf);
> -    }
>      virMutexDestroy (&driverState->lock);
>  mutex_error:
>      VIR_FREE(driverState);
> -- 

ACK


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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