util: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageSource

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
John Ferlan
2019-02-12 13:19:26 -05:00
parent b20e957d0a
commit bf688a0067
9 changed files with 40 additions and 63 deletions
+2 -4
View File
@@ -46,14 +46,14 @@ testBackingXMLjsonXML(const void *args)
xmlDocPtr xml = NULL;
xmlXPathContextPtr ctxt = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
virStorageSourcePtr xmlsrc = NULL;
virStorageSourcePtr jsonsrc = NULL;
virJSONValuePtr backendprops = NULL;
virJSONValuePtr wrapper = NULL;
char *propsstr = NULL;
char *protocolwrapper = NULL;
char *actualxml = NULL;
int ret = -1;
VIR_AUTOPTR(virStorageSource) xmlsrc = NULL;
VIR_AUTOPTR(virStorageSource) jsonsrc = NULL;
if (VIR_ALLOC(xmlsrc) < 0)
return -1;
@@ -104,8 +104,6 @@ testBackingXMLjsonXML(const void *args)
ret = 0;
cleanup:
virStorageSourceFree(xmlsrc);
virStorageSourceFree(jsonsrc);
VIR_FREE(propsstr);
VIR_FREE(protocolwrapper);
VIR_FREE(actualxml);