Hi,

The second patch. It frees the receive buffers when the device is
released to avoid possible memory leak.

Thanks.
Amit Chaudhary
This patch frees the receive buffer when the device is close, to avoid
leaking any buffers that happen to be in the receive buffer.

Signed-off-by: Amit Chaudhary <[EMAIL PROTECTED]>

Index: linux-2.6.26/drivers/char/ipmi/ipmi_devintf.c
===================================================================
--- linux-2.6.26.orig/drivers/char/ipmi/ipmi_devintf.c
+++ linux-2.6.26/drivers/char/ipmi/ipmi_devintf.c
@@ -180,6 +180,7 @@ static int ipmi_open(struct inode *inode
 static int ipmi_release(struct inode *inode, struct file *file)
 {
 	struct ipmi_file_private *priv = file->private_data;
+	struct ipmi_recv_msg     *msg, *msg2;
 	int                      rv;
 
 	rv = ipmi_destroy_user(priv->user);
@@ -188,7 +189,11 @@ static int ipmi_release(struct inode *in
 
 	ipmi_fasync (-1, file, 0);
 
-	/* FIXME - free the messages in the list. */
+	list_for_each_entry_safe(msg, msg2, &priv->recv_msgs, link) {
+		list_del(&msg->link);
+		ipmi_free_recv_msg(msg);
+	}
+
 	kfree(priv);
 
 	return 0;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to