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