1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-02-14 05:57:26 +03:00

util: storagefile: Simplify cleanup in virStorageSourceParseBackingJSON

Automatically free the 'root' temporary variable to get rid of some
complexity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-08-15 16:25:47 +02:00
parent e8578b245b
commit fe434a0ceb

View File

@ -3624,16 +3624,12 @@ static int
virStorageSourceParseBackingJSON(virStorageSourcePtr src,
const char *json)
{
virJSONValuePtr root = NULL;
int ret = -1;
VIR_AUTOPTR(virJSONValue) root = NULL;
if (!(root = virJSONValueFromString(json)))
return -1;
ret = virStorageSourceParseBackingJSONInternal(src, root);
virJSONValueFree(root);
return ret;
return virStorageSourceParseBackingJSONInternal(src, root);
}