diff options
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r-- | security/selinux/ss/services.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 4f233d9960e7..876b815c1ba4 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -981,11 +981,12 @@ static int string_to_context_struct(struct policydb *pol, | |||
981 | /* Check the validity of the new context. */ | 981 | /* Check the validity of the new context. */ |
982 | if (!policydb_context_isvalid(pol, ctx)) { | 982 | if (!policydb_context_isvalid(pol, ctx)) { |
983 | rc = -EINVAL; | 983 | rc = -EINVAL; |
984 | context_destroy(ctx); | ||
985 | goto out; | 984 | goto out; |
986 | } | 985 | } |
987 | rc = 0; | 986 | rc = 0; |
988 | out: | 987 | out: |
988 | if (rc) | ||
989 | context_destroy(ctx); | ||
989 | return rc; | 990 | return rc; |
990 | } | 991 | } |
991 | 992 | ||
@@ -1038,8 +1039,7 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len, | |||
1038 | } else if (rc) | 1039 | } else if (rc) |
1039 | goto out; | 1040 | goto out; |
1040 | rc = sidtab_context_to_sid(&sidtab, &context, sid); | 1041 | rc = sidtab_context_to_sid(&sidtab, &context, sid); |
1041 | if (rc) | 1042 | context_destroy(&context); |
1042 | context_destroy(&context); | ||
1043 | out: | 1043 | out: |
1044 | read_unlock(&policy_rwlock); | 1044 | read_unlock(&policy_rwlock); |
1045 | kfree(scontext2); | 1045 | kfree(scontext2); |