]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Fix leak in securityselinuxtest
authorJohn Ferlan <jferlan@redhat.com>
Wed, 23 Aug 2017 16:32:23 +0000 (12:32 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 23 Aug 2017 16:32:23 +0000 (12:32 -0400)
If we jump to the error: label and @secbuf is allocated, then it's not
free'd at all.

Found by Coverity

tests/securityselinuxtest.c

index f6bc07a84640b5ee320fdba9f5c2ac6181974434..0ac28288f16cda73bf55b285f1ae7b8b1b38d286 100644 (file)
@@ -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;
 }