On Wed, Sep 02, 2015 at 05:58:18PM +0200, Michal Privoznik wrote:
Let's move some variables from an inside loop to global function declaration header block. It's going to be easier for next patches. At the same time, order the cleanup calls at the function's end so it's easier to track which variables are freed and which not. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- tools/virsh-domain-monitor.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
I did not follow the discussion around 2/2, but this one does not do any functional change and cleans up the code nicely, so ACK ... [1]
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 340a8e2..d4e500b 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -549,24 +544,28 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) if (details) { vshPrint(ctl, "%-10s %-10s %-10s %s\n", type, device, target, source ? source : "-"); - VIR_FREE(type); - VIR_FREE(device); } else { vshPrint(ctl, "%-10s %s\n", target, source ? source : "-"); } - VIR_FREE(target); VIR_FREE(source); + VIR_FREE(target); + VIR_FREE(device); + VIR_FREE(type); } ret = true; cleanup: + VIR_FREE(source); + VIR_FREE(target); + VIR_FREE(device); + VIR_FREE(type); VIR_FREE(disks); - virDomainFree(dom); - VIR_FREE(xml); - xmlFreeDoc(xmldoc); xmlXPathFreeContext(ctxt); + xmlFreeDoc(xmldoc); + VIR_FREE(xml); + virDomainFree(dom);
[1] ... even though I don't understand why these are reordered.
return ret; } -- 2.4.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list