[PATCH 15/25] virJSONValueObjectAddVArgs: Use autofree for the temporary bitmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virjson.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/util/virjson.c b/src/util/virjson.c
index e4d71d3e09..7b52525797 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -305,7 +305,7 @@ virJSONValueObjectAddVArgs(virJSONValuePtr obj,
         case 'M':
         case 'm': {
             virBitmapPtr map = va_arg(args, virBitmapPtr);
-            virJSONValuePtr jsonMap;
+            g_autoptr(virJSONValue) jsonMap = NULL;

             if (!map) {
                 if (type == 'M')
@@ -321,7 +321,8 @@ virJSONValueObjectAddVArgs(virJSONValuePtr obj,
                 return -1;

             if ((rc = virJSONValueObjectAppend(obj, key, jsonMap)) < 0)
-                virJSONValueFree(jsonMap);
+                return -1;
+            jsonMap = NULL;
         } break;

         default:
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux