From 66050f0f892c2a62e56136d25886f8416d7881ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Wed, 2 Apr 2014 14:37:35 +0200 Subject: [PATCH] Fix coverity-reported leak in virSecurityManagerGenLabel Coverity complains about a possible leak of seclabel if !sec_managers[i]->drv->domainGenSecurityLabel is true and the seclabel might be overwritten by the next iteration of the loop. This leak should never happen, because every security driver has domainGenSecurityLabel defined. --- src/security/security_manager.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/security/security_manager.c b/src/security/security_manager.c index d68c7e949e..79edb07e91 100644 --- a/src/security/security_manager.c +++ b/src/security/security_manager.c @@ -514,6 +514,8 @@ int virSecurityManagerGenLabel(virSecurityManagerPtr mgr, if (!sec_managers[i]->drv->domainGenSecurityLabel) { virReportUnsupportedError(); + virSecurityLabelDefFree(seclabel); + seclabel = NULL; } else { /* The seclabel must be added to @vm prior calling domainGenSecurityLabel * which may require seclabel to be presented already */