Hi,

as promised the two patches which close the memleaks. I've not spend very much 
time to find out how much impact this bug has. It is at least a mem leak. 
Maybe it will kill the ioctl callbacks at all if the demux module has been 
reloaded. That depends on how the list_for_each traverses the list.

The ioctl patch should be applied. The other depends on the patch i send 
earlier today.

But be aware. Again untested. I just verified it compiles.

So long,
   Florian
--- dvb_frontend.c-patched	Fri Nov 15 12:13:41 2002
+++ dvb_frontend.c	Fri Nov 15 12:26:21 2002
@@ -682,7 +682,7 @@ dvb_remove_frontend_ioctls (struct dvb_a
                             int (*after_ioctl)  (struct dvb_frontend *frontend,
                                                  unsigned int cmd, void *arg))
 {
-        struct list_head *entry;
+	struct list_head *entry, *n;
 
 	dprintk ("%s\n", __FUNCTION__);
 
@@ -704,6 +704,22 @@ dvb_remove_frontend_ioctls (struct dvb_a
 		}
 	}
 
+	list_for_each_safe (entry, n, &frontend_ioctl_list) {
+		struct dvb_frontend_ioctl_data *ioctl;
+
+		ioctl = list_entry (entry, struct dvb_frontend_ioctl_data, list_head);
+
+		if (ioctl->adapter == adapter &&
+		    ioctl->before_ioctl == before_ioctl &&
+		    ioctl->after_ioctl == after_ioctl)
+		{
+			list_del (&ioctl->list_head);
+			kfree (ioctl);
+			
+			break;
+		}
+	}
+
 	up (&frontend_mutex);
 }
 
--- dvb_frontend.c-patched2	Fri Nov 15 12:26:21 2002
+++ dvb_frontend.c	Fri Nov 15 12:29:52 2002
@@ -775,7 +775,7 @@ void
 dvb_remove_frontend_notifier (struct dvb_adapter *adapter,
 			      void (*callback) (fe_status_t s, void *data))
 {
-	struct list_head *entry;
+	struct list_head *entry, *n;
 
 	dprintk ("%s\n", __FUNCTION__);
 
@@ -795,6 +795,21 @@ dvb_remove_frontend_notifier (struct dvb
 		}
 	}
 
+	list_for_each_safe (entry, n, &frontend_notifier_list) {
+		struct dvb_frontend_notifier_data *notifier;
+
+		notifier = list_entry (entry, struct dvb_frontend_notifier_data, list_head);
+
+		if (notifier->adapter == adapter &&
+		    notifier->callback == callback)
+		{
+			list_del (&notifier->list_head);
+			kfree (notifier);
+			
+			break;
+		}
+	}
+
 	up (&frontend_mutex);
 }
 

Reply via email to