[libvirt] [PATCH] virCapabilitiesFormatCaches: free cpus_str right after use

Ján Tomko posted 1 patch 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/2403dcce51bef33d05700a78e16de548f484ea44.1501681533.git.jtomko@redhat.com
src/conf/capabilities.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[libvirt] [PATCH] virCapabilitiesFormatCaches: free cpus_str right after use
Posted by Ján Tomko 6 years, 8 months ago
This will simplify the cleanup when we start checking for
buffer errors.
---
Pushed as trivial.

 src/conf/capabilities.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 0f99f3096..561a6cf9e 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -904,6 +904,7 @@ virCapabilitiesFormatCaches(virBufferPtr buf,
                           bank->size >> (kilos * 10),
                           kilos ? "KiB" : "B",
                           cpus_str);
+        VIR_FREE(cpus_str);
 
         virBufferAdjustIndent(&controlBuf, indent + 4);
         for (j = 0; j < bank->ncontrols; j++) {
@@ -937,8 +938,6 @@ virCapabilitiesFormatCaches(virBufferPtr buf,
         } else {
             virBufferAddLit(buf, "/>\n");
         }
-
-        VIR_FREE(cpus_str);
     }
 
     virBufferAdjustIndent(buf, -2);
-- 
2.13.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list