[PATCH] mem leaks in drivers/media/video/several

From: Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Date: Sat Oct 14 2000 - 09:58:02 EST


Linus,

        Resubmitting these, please apply.

- Arnaldo

diff -ur linux-2.4.0-test10-3/drivers/media/video/tda7432.c linux-2.4.0-test10-3.acme/drivers/media/video/tda7432.c
--- linux-2.4.0-test10-3/drivers/media/video/tda7432.c Thu Aug 24 07:40:01 2000
+++ linux-2.4.0-test10-3.acme/drivers/media/video/tda7432.c Sat Oct 14 12:52:06 2000
@@ -25,6 +25,10 @@
  * Added I2C_DRIVERID_TDA7432
  * added loudness insmod control
  * Revision: 0.1 - initial version
+ *
+ * Changes:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/14/2000
+ * - resource allocation fixes in tda7432_attach
  */
 
 #include <linux/module.h>
@@ -320,8 +324,10 @@
         client->addr = addr;
         
         client->data = t = kmalloc(sizeof *t,GFP_KERNEL);
- if (!t)
+ if (!t) {
+ kfree(client);
                 return -ENOMEM;
+ }
         memset(t,0,sizeof *t);
         do_tda7432_init(client);
         MOD_INC_USE_COUNT;
diff -ur linux-2.4.0-test10-3/drivers/media/video/tda8425.c linux-2.4.0-test10-3.acme/drivers/media/video/tda8425.c
--- linux-2.4.0-test10-3/drivers/media/video/tda8425.c Thu Aug 24 07:40:01 2000
+++ linux-2.4.0-test10-3.acme/drivers/media/video/tda8425.c Sat Oct 14 12:52:06 2000
@@ -13,6 +13,10 @@
  * two stereo inputs, so if someone has this card, could they tell me if the
  * second one can be used for anything (i.e., does it have an external input
  * that you can't hear even if you set input to composite?)
+ *
+ * Changes:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/14/2000
+ * - resource allocation fixes in tda8425_attach
  */
 
 #include <linux/module.h>
@@ -148,8 +152,10 @@
         client->addr = addr;
 
         client->data = tda = kmalloc(sizeof *tda,GFP_KERNEL);
- if (!tda)
+ if (!tda) {
+ kfree(client);
                 return -ENOMEM;
+ }
         memset(tda,0,sizeof *tda);
         do_tda8425_init(client);
         MOD_INC_USE_COUNT;
diff -ur linux-2.4.0-test10-3/drivers/media/video/tda985x.c linux-2.4.0-test10-3.acme/drivers/media/video/tda985x.c
--- linux-2.4.0-test10-3/drivers/media/video/tda985x.c Thu Aug 24 07:40:01 2000
+++ linux-2.4.0-test10-3.acme/drivers/media/video/tda985x.c Sat Oct 14 12:52:06 2000
@@ -11,6 +11,9 @@
  * Based on tda9855.c by Steve VanDeBogart (vandebo@uclink.berkeley.edu)
  * Which was based on tda8425.c by Greg Alexander (c) 1998
  *
+ * Contributors:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+ *
  * OPTIONS:
  * debug - set to 1 if you'd like to see debug messages
  * - set to 2 if you'd like to be flooded with debug messages
@@ -22,6 +25,7 @@
  * Fine tune sound
  * Get rest of capabilities into video_audio struct...
  *
+ * Revision 0.6 - resource allocation fixes in tda985x_attach (08/14/2000)
  * Revision 0.5 - cleaned up debugging messages, added debug level=2
  * Revision: 0.4 - check for correct chip= insmod value
  * also cleaned up comments a bit
@@ -350,8 +354,10 @@
         client->addr = addr;
         
         client->data = t = kmalloc(sizeof *t,GFP_KERNEL);
- if (!t)
+ if (!t) {
+ kfree(client);
                 return -ENOMEM;
+ }
         memset(t,0,sizeof *t);
         do_tda985x_init(client);
         MOD_INC_USE_COUNT;
diff -ur linux-2.4.0-test10-3/drivers/media/video/tda9875.c linux-2.4.0-test10-3.acme/drivers/media/video/tda9875.c
--- linux-2.4.0-test10-3/drivers/media/video/tda9875.c Thu Aug 24 07:40:01 2000
+++ linux-2.4.0-test10-3.acme/drivers/media/video/tda9875.c Sat Oct 14 12:52:06 2000
@@ -11,9 +11,13 @@
  * Based on tda9855.c by Steve VanDeBogart (vandebo@uclink.berkeley.edu)
  * Which was based on tda8425.c by Greg Alexander (c) 1998
  *
+ * Contributors:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.2)
+ *
  * OPTIONS:
  * debug - set to 1 if you'd like to see debug messages
  *
+ * Revision 0.2 - resource allocation fixes in tda9875_attach (08/14/2000)
  * Revision: 0.1 - original version
  */
 
@@ -232,8 +236,10 @@
         client->addr = addr;
         
         client->data = t = kmalloc(sizeof *t,GFP_KERNEL);
- if (!t)
+ if (!t) {
+ kfree(client);
                 return -ENOMEM;
+ }
         memset(t,0,sizeof *t);
         do_tda9875_init(client);
         MOD_INC_USE_COUNT;
diff -ur linux-2.4.0-test10-3/drivers/media/video/tea6300.c linux-2.4.0-test10-3.acme/drivers/media/video/tea6300.c
--- linux-2.4.0-test10-3/drivers/media/video/tea6300.c Thu Aug 24 07:40:01 2000
+++ linux-2.4.0-test10-3.acme/drivers/media/video/tea6300.c Sat Oct 14 12:52:06 2000
@@ -15,6 +15,10 @@
  * balance (different left,right values) and, if someone ever finds a card
  * with the support (or if you're careful with a soldering iron), fade
  * (front/back).
+ *
+ * Changes:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/14/2000
+ * - resource allocation fixes in tea6300_attach
  */
 
 #include <linux/module.h>
@@ -170,8 +174,10 @@
         client->addr = addr;
 
         client->data = tea = kmalloc(sizeof *tea,GFP_KERNEL);
- if (!tea)
+ if (!tea) {
+ kfree(client);
                 return -ENOMEM;
+ }
         memset(tea,0,sizeof *tea);
         do_tea6300_init(client);
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:27 EST