Hi,

Clean up irq urb when not enough memory is available.

Bye,
  Henning

--- linux-2.6.0-test1.newids8/drivers/usb/image/scanner.c       2003-07-15 
11:41:02.000000000 +0200
+++ linux-2.6.0-test1.irq-cleanup/drivers/usb/image/scanner.c   2003-07-17 
19:10:37.000000000 +0200
@@ -367,6 +367,7 @@
  * 0.4.14  2003-07-15
  *    - Fixed race between open and probe (Oliver Neukum).
  *    - Added vendor/product ids for Avision, Canon, HP, Microtek and Relisys 
scanners.
+ *    - Clean up irq urb when not enough memory is available.
  *
  * TODO
  *    - Performance
@@ -1072,6 +1073,9 @@
 /* Ok, now initialize all the relevant values */
        if (!(scn->obuf = (char *)kmalloc(OBUF_SIZE, GFP_KERNEL))) {
                err("probe_scanner(%d): Not enough memory for the output buffer.", 
intf->minor);
+               if (have_intr)
+                       usb_unlink_urb(scn->scn_irq);
+               usb_free_urb(scn->scn_irq);
                kfree(scn);
                up(&scn_mutex);
                return -ENOMEM;
@@ -1080,6 +1084,9 @@
 
        if (!(scn->ibuf = (char *)kmalloc(IBUF_SIZE, GFP_KERNEL))) {
                err("probe_scanner(%d): Not enough memory for the input buffer.", 
intf->minor);
+               if (have_intr)
+                       usb_unlink_urb(scn->scn_irq);
+               usb_free_urb(scn->scn_irq);
                kfree(scn->obuf);
                kfree(scn);
                up(&scn_mutex);


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to