Automatically free the 'root' temporary variable to get rid fo some
complexity.
Signed-off-by: Peter Krempa
---
src/util/virstoragefile.c | 8 ++--
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index e93f6285b0..6fff013e3a 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -3622,16 +3622,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);
}
--
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list