From f972546d4131686a85f5d124e9feec49b77419c1 Mon Sep 17 00:00:00 2001 Message-Id: From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Wed, 28 Aug 2013 10:24:10 +0200 Subject: [PATCH] virsh: free the formatting string when listing pool details https://bugzilla.redhat.com/show_bug.cgi?id=1001957 ==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 (cherry picked from commit 785ff34bf884a721544ea531c000e8a140e485fa) --- tools/virsh-pool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index b8fc8d7..e31e76c 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -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); -- 1.8.3.2