Re: [libvirt] [PATCH 04/14] util: storagefile: Simplify cleanup in virStorageSourceParseBackingJSON

2019-08-21 Thread Ján Tomko

On Fri, Aug 16, 2019 at 12:39:25PM +0200, Peter Krempa wrote:

Automatically free the 'root' temporary variable to get rid fo some


s/fo/of/


complexity.

Signed-off-by: Peter Krempa 
---
src/util/virstoragefile.c | 8 ++--
1 file changed, 2 insertions(+), 6 deletions(-)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 04/14] util: storagefile: Simplify cleanup in virStorageSourceParseBackingJSON

2019-08-16 Thread Peter Krempa
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