mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
cmdDomIfAddr: Free @ip_addr_str
The variable holds formatted suffix to each line printed out (address type, address and prefix). However, the variable is never freed. At the same time, honour fact, that data held in the variable is not constant. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
100fb08cee
commit
0aff8fa829
@ -2269,7 +2269,7 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
for (i = 0; i < ifaces_count; i++) {
|
for (i = 0; i < ifaces_count; i++) {
|
||||||
virDomainInterfacePtr iface = ifaces[i];
|
virDomainInterfacePtr iface = ifaces[i];
|
||||||
const char *ip_addr_str = NULL;
|
char *ip_addr_str = NULL;
|
||||||
const char *type = NULL;
|
const char *type = NULL;
|
||||||
|
|
||||||
if (interface && STRNEQ(interface, iface->name))
|
if (interface && STRNEQ(interface, iface->name))
|
||||||
@ -2308,7 +2308,7 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd)
|
|||||||
ip_addr_str = virBufferContentAndReset(&buf);
|
ip_addr_str = virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
if (!ip_addr_str)
|
if (!ip_addr_str)
|
||||||
ip_addr_str = "";
|
ip_addr_str = vshStrdup(ctl, "");
|
||||||
|
|
||||||
/* Don't repeat interface name */
|
/* Don't repeat interface name */
|
||||||
if (full || !j)
|
if (full || !j)
|
||||||
@ -2320,6 +2320,7 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd)
|
|||||||
"-", "-", ip_addr_str);
|
"-", "-", ip_addr_str);
|
||||||
|
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
|
VIR_FREE(ip_addr_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user