summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/apparmor/audit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/security/apparmor/audit.c b/security/apparmor/audit.c
index 575f3e9c8c80..eeaddfe0c0fb 100644
--- a/security/apparmor/audit.c
+++ b/security/apparmor/audit.c
@@ -200,10 +200,12 @@ int aa_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule)
/* Currently rules are treated as coming from the root ns */
rule->label = aa_label_parse(&root_ns->unconfined->label, rulestr,
GFP_KERNEL, true, false);
- if (IS_ERR(rule->label))
+ if (IS_ERR(rule->label)) {
+ aa_audit_rule_free(rule);
return PTR_ERR(rule->label);
- *vrule = rule;
+ }
+ *vrule = rule;
return 0;
}