From: Ján Tomko Date: Tue, 1 Oct 2013 11:15:12 +0000 (+0200) Subject: selinux: Only close the selabel_handle once X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f1bdcb2be92b5545d5c33485431d7129a8098cd9;p=libvirt.git selinux: Only close the selabel_handle once On selinux driver initialization failure (missing/incorrectly formatted contexts file), selabel_handle was closed twice. Introduced by 6159710. --- diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 38de06076b..c408fa8fbc 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -460,6 +460,7 @@ virSecuritySELinuxLXCInitialize(virSecurityManagerPtr mgr) error: # if HAVE_SELINUX_LABEL_H selabel_close(data->label_handle); + data->label_handle = NULL; # endif virConfFree(selinux_conf); VIR_FREE(data->domain_context); @@ -547,6 +548,7 @@ virSecuritySELinuxQEMUInitialize(virSecurityManagerPtr mgr) error: #if HAVE_SELINUX_LABEL_H selabel_close(data->label_handle); + data->label_handle = NULL; #endif VIR_FREE(data->domain_context); VIR_FREE(data->alt_domain_context); @@ -808,7 +810,8 @@ virSecuritySELinuxSecurityDriverClose(virSecurityManagerPtr mgr) return 0; #if HAVE_SELINUX_LABEL_H - selabel_close(data->label_handle); + if (data->label_handle) + selabel_close(data->label_handle); #endif virHashFree(data->mcs);