[PATCH] tests: Fix leak in securityselinuxtest

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

 



If we jump to the error: label and @secbuf is allocated, then it's not
free'd at all.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 tests/securityselinuxtest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c
index f6bc07a..0ac2828 100644
--- a/tests/securityselinuxtest.c
+++ b/tests/securityselinuxtest.c
@@ -68,7 +68,7 @@ testBuildDomainDef(bool dynamic,
                    const char *baselabel)
 {
     virDomainDefPtr def;
-    virSecurityLabelDefPtr secdef;
+    virSecurityLabelDefPtr secdef = NULL;
 
     if (!(def = virDomainDefNew()))
         goto error;
@@ -98,6 +98,7 @@ testBuildDomainDef(bool dynamic,
 
  error:
     virDomainDefFree(def);
+    virSecurityLabelDefFree(secdef);
     return NULL;
 }
 
-- 
2.9.5

--
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]
  Powered by Linux