mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
parent
e8578b245b
commit
fe434a0ceb
@ -3624,16 +3624,12 @@ static int
|
|||||||
virStorageSourceParseBackingJSON(virStorageSourcePtr src,
|
virStorageSourceParseBackingJSON(virStorageSourcePtr src,
|
||||||
const char *json)
|
const char *json)
|
||||||
{
|
{
|
||||||
virJSONValuePtr root = NULL;
|
VIR_AUTOPTR(virJSONValue) root = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (!(root = virJSONValueFromString(json)))
|
if (!(root = virJSONValueFromString(json)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virStorageSourceParseBackingJSONInternal(src, root);
|
return virStorageSourceParseBackingJSONInternal(src, root);
|
||||||
|
|
||||||
virJSONValueFree(root);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user