If both 'tree' and 'watch' are valid we must call audit_put_tree(), just like the preceding code within audit_add_rule().
Showing the changes to kernel/auditfilter.c (1 of 1 file). Show all
Unified · Split
| @@ -865,6 +865,12 @@ static inline int audit_add_rule(struct audit_entry *entry) · 864 unmodified lines | |||
| 865 | err = audit_add_watch(&entry->rule, &list); | 865 | err = audit_add_watch(&entry->rule, &list); |
| 866 | if (err) { | 866 | if (err) { |
| 867 | mutex_unlock(&audit_filter_mutex); | 867 | mutex_unlock(&audit_filter_mutex); |
| 868 | /* | ||
| 869 | * normally audit_add_tree_rule() will free it | ||
| 870 | * on failure | ||
| 871 | */ | ||
| 872 | if (tree) | ||
| 873 | audit_put_tree(tree); | ||
| 868 | goto error; | 874 | goto error; |
| 869 | } | 875 | } |
| 870 | } | 876 | } |