From: John Ferlan Date: Wed, 23 Aug 2017 16:32:23 +0000 (-0400) Subject: tests: Fix leak in securityselinuxtest X-Git-Tag: v3.7.0-rc1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f60ec522a3c508c749d10e70f29c4ad8c6120b36;p=thirdparty%2Flibvirt.git tests: Fix leak in securityselinuxtest If we jump to the error: label and @secbuf is allocated, then it's not free'd at all. Found by Coverity --- diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c index f6bc07a846..0ac28288f1 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; }