[PATCH 3/6] domain_conf: Resolve Coverity RESOURCE_LEAK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit id's 'c9a641f1e' and 'aa2cc721' added calls to virSocketAddrFormat
and did not VIR_FREE() the return memory.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d1a483a..b53cb8d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17270,6 +17270,7 @@ virDomainNetIpsFormat(virBufferPtr buf, virDomainNetIpDefPtr *ips, size_t nips)
             familyStr = "ipv4";
         virBufferAsprintf(buf, "<ip address='%s'",
                           ipStr);
+        VIR_FREE(ipStr);
         if (familyStr)
             virBufferAsprintf(buf, " family='%s'", familyStr);
         if (ips[i]->prefix != 0)
@@ -17296,10 +17297,12 @@ virDomainNetRoutesFormat(virBufferPtr buf,
         else if (VIR_SOCKET_ADDR_IS_FAMILY(&route->via, AF_INET))
             familyStr = "ipv4";
         virBufferAsprintf(buf, "<route family='%s' via='%s'", familyStr, via);
+        VIR_FREE(via);
 
         if (VIR_SOCKET_ADDR_VALID(&route->to)) {
             to = virSocketAddrFormat(&route->to);
             virBufferAsprintf(buf, " address='%s'", to);
+            VIR_FREE(to);
         }
 
         if (route->prefix > 0)
-- 
2.1.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]