]> xenbits.xensource.com Git - libvirt.git/commitdiff
virCapabilitiesFormatCaches: free cpus_str right after use
authorJán Tomko <jtomko@redhat.com>
Wed, 2 Aug 2017 13:38:40 +0000 (15:38 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 2 Aug 2017 13:44:34 +0000 (15:44 +0200)
This will simplify the cleanup when we start checking for
buffer errors.

src/conf/capabilities.c

index 0f99f3096292c572d0f1efa459a086e568baacbb..561a6cf9e76a9e273091292452dac9138899254d 100644 (file)
@@ -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);