]> xenbits.xensource.com Git - libvirt.git/commitdiff
virschematest: call va_end even on OOM
authorJán Tomko <jtomko@redhat.com>
Wed, 8 Jun 2016 14:33:26 +0000 (16:33 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 8 Jun 2016 14:33:26 +0000 (16:33 +0200)
Jump to cleanup if virAsprintf fails.

tests/virschematest.c

index c1730379008badba957fa34d6189eaf4eb264b27..f15e2ab7c963499ebe4761257fa743c9205b5dd5 100644 (file)
@@ -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;