[PATCH] virschematest: call va_end even on OOM

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

 



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 c173037..f15e2ab 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -117,23 +117,23 @@ 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;
     char *dir_path = NULL;
     const char *dir;
 
     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;
 
     while ((dir = va_arg(args, char *))) {
         if (virAsprintf(&dir_path, "%s/%s", abs_srcdir, dir) < 0) {
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]