mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user