From f60ec522a3c508c749d10e70f29c4ad8c6120b36 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Wed, 23 Aug 2017 12:32:23 -0400 Subject: [PATCH] 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 --- tests/securityselinuxtest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- GitLab