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, 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;
} }