]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: free the formatting string when listing pool details
authorJán Tomko <jtomko@redhat.com>
Tue, 27 Aug 2013 11:34:09 +0000 (13:34 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 28 Aug 2013 06:05:56 +0000 (08:05 +0200)
==23== 41 bytes in 1 blocks are definitely lost in loss record 626 of 727
==23==    by 0x4F0099F: virAsprintfInternal (virstring.c:358)
==23==    by 0x15D2C9: cmdPoolList (virsh-pool.c:1268)

https://bugzilla.redhat.com/show_bug.cgi?id=1001536

tools/virsh-pool.c

index 592b81ff57d83bb238a7813c84800e609fe089f2..3d3c61eebc467a67453ff9646649e98062552ca0 100644 (file)
@@ -1264,7 +1264,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
     /* Create the output template.  Each column is sized according to
      * the longest string.
      */
-    char *outputStr;
+    char *outputStr = NULL;
     ret = virAsprintf(&outputStr,
               "%%-%lus  %%-%lus  %%-%lus  %%-%lus  %%%lus  %%%lus  %%%lus\n",
               (unsigned long) nameStrLength,
@@ -1319,6 +1319,7 @@ asprintf_failure:
     functionReturn = false;
 
 cleanup:
+    VIR_FREE(outputStr);
     if (list && list->npools) {
         for (i = 0; i < list->npools; i++) {
             VIR_FREE(poolInfoTexts[i].state);