Skip to contentSkip to conversation

SELinux: Leak in error path

PATCH In review Alexander Nyberg 3 participants 3 messages Mar 1, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SELinux: Leak in error path

There's a leak here in the first error path.

Found by the Coverity tool.

===== security/selinux/ss/conditional.c 1.3 vs edited =====

security/selinux/ss/conditional.c +3 -1
@@ -401,8 +401,10 @@ static int cond_read_node(struct policyd
 		expr->expr_type = le32_to_cpu(buf[0]);
 		expr->bool = le32_to_cpu(buf[1]);
 
-		if (!expr_isvalid(p, expr))
+		if (!expr_isvalid(p, expr)) {
+			kfree(expr);
 			goto err;
+		}
 
 		if (i == 0) {
 			node->expr = expr;