]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Use full force of our VIR_AUTO* machinery in testBackingXMLjsonXML
authorPeter Krempa <pkrempa@redhat.com>
Fri, 8 Mar 2019 15:10:07 +0000 (16:10 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 20 Mar 2019 07:17:05 +0000 (08:17 +0100)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemublocktest.c

index 4cd15a1dff6f9f6fb07fc73213c7f39875799387..9e4af075b7973910312e2d04250be5cf3b043af0 100644 (file)
@@ -43,14 +43,14 @@ static int
 testBackingXMLjsonXML(const void *args)
 {
     const struct testBackingXMLjsonXMLdata *data = args;
-    xmlDocPtr xml = NULL;
-    xmlXPathContextPtr ctxt = NULL;
-    virBuffer buf = VIR_BUFFER_INITIALIZER;
-    virJSONValuePtr backendprops = NULL;
-    virJSONValuePtr wrapper = NULL;
-    char *propsstr = NULL;
-    char *protocolwrapper = NULL;
-    char *actualxml = NULL;
+    VIR_AUTOPTR(xmlDoc) xml = NULL;
+    VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
+    VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+    VIR_AUTOPTR(virJSONValue) backendprops = NULL;
+    VIR_AUTOPTR(virJSONValue) wrapper = NULL;
+    VIR_AUTOFREE(char *) propsstr = NULL;
+    VIR_AUTOFREE(char *) protocolwrapper = NULL;
+    VIR_AUTOFREE(char *) actualxml = NULL;
     int ret = -1;
     VIR_AUTOUNREF(virStorageSourcePtr) xmlsrc = NULL;
     VIR_AUTOUNREF(virStorageSourcePtr) jsonsrc = NULL;
@@ -104,15 +104,6 @@ testBackingXMLjsonXML(const void *args)
     ret = 0;
 
  cleanup:
-    VIR_FREE(propsstr);
-    VIR_FREE(protocolwrapper);
-    VIR_FREE(actualxml);
-    virJSONValueFree(backendprops);
-    virJSONValueFree(wrapper);
-    virBufferFreeAndReset(&buf);
-    xmlXPathFreeContext(ctxt);
-    xmlFreeDoc(xml);
-
     return ret;
 }