[libvirt] [PATCH 06/20] test: testOpenDefault: introduce cleanup path

John Ferlan jferlan at redhat.com
Wed Mar 14 22:57:52 UTC 2018



On 03/08/2018 07:20 AM, Marc Hartmayer wrote:
> The two code paths have some cleanup in common so lets refactor it.
> 
> Signed-off-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
> Reviewed-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
> ---
>  src/test/test_driver.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 2773f5c758c8..e7307fddad4a 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -1306,6 +1306,7 @@ testOpenFromFile(virConnectPtr conn, const char *file)
>  static int
>  testOpenDefault(virConnectPtr conn)
>  {
> +    int ret;

So that no one ever adds a goto cleanup some day and @ret isn't set,
let's initialize to VIR_DRV_OPEN_ERROR (and remove that setting in the
error: label).

Reviewed-by: John Ferlan <jferlan at redhat.com>

John

[I'll continue with the rest tomorrow]




More information about the libvir-list mailing list