From 09b406a7562963d43b4c743f09fd97fb76777512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Wed, 8 Jun 2016 16:33:26 +0200 Subject: [PATCH] virschematest: call va_end even on OOM Jump to cleanup if virAsprintf fails. --- tests/virschematest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/virschematest.c b/tests/virschematest.c index c173037900..f15e2ab7c9 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -120,7 +120,7 @@ testSchemaDir(const char *schema, static int testSchemaDirs(const char *schema, ...) { - virXMLValidatorPtr validator; + virXMLValidatorPtr validator = NULL; va_list args; int ret = 0; char *schema_path = NULL; @@ -130,7 +130,7 @@ testSchemaDirs(const char *schema, ...) va_start(args, schema); if (virAsprintf(&schema_path, "%s/docs/schemas/%s", abs_topsrcdir, schema) < 0) - return -1; + goto cleanup; if (!(validator = virXMLValidatorInit(schema_path))) goto cleanup;