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>
for (i = 0; i < ifaces_count; i++) {
virDomainInterfacePtr iface = ifaces[i];
- const char *ip_addr_str = NULL;
+ char *ip_addr_str = NULL;
const char *type = NULL;
if (interface && STRNEQ(interface, iface->name))
ip_addr_str = virBufferContentAndReset(&buf);
if (!ip_addr_str)
- ip_addr_str = "";
+ ip_addr_str = vshStrdup(ctl, "");
/* Don't repeat interface name */
if (full || !j)
"-", "-", ip_addr_str);
virBufferFreeAndReset(&buf);
+ VIR_FREE(ip_addr_str);
}
}