[PATCH] leak in audit_inode_context

Steve Grubb sgrubb at redhat.com
Fri Mar 10 13:21:15 UTC 2006


Hi,

Tracked down the last memory leak that I can see. When inode data
gets updated, new context information is allocated and the ctx pointer
gets overwritten without freeing what it points to. The patch below fixes
this.

Signed-off-by: Steve Grubb <sgrubb at redhat.com>


diff -urp linux-2.6.15.x86_64.orig/kernel/auditsc.c linux-2.6.15.x86_64/kernel/auditsc.c
--- linux-2.6.15.x86_64.orig/kernel/auditsc.c	2006-03-09 16:53:46.000000000 -0500
+++ linux-2.6.15.x86_64/kernel/auditsc.c	2006-03-09 16:52:10.000000000 -0500
@@ -985,6 +985,7 @@ void audit_inode_context(int idx, const 
 	if (len < 0)
 		goto error_path;
 
+	kfree(context->names[idx].ctx);
 	context->names[idx].ctx = ctx;
 	goto ret;
 




More information about the Linux-audit mailing list