diff options
author | Dan Carpenter <error27@gmail.com> | 2010-03-06 21:35:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-07 18:25:51 -0500 |
commit | 0e2b807234c42fab59f98ec913db30dfda0e63a7 (patch) | |
tree | cbfc388f8028fac2da91bc61b97b8dff82d34732 /drivers/net/irda/irda-usb.c | |
parent | 72150e9b7fec217fbd646a29ea2f65a3d4d55ea9 (diff) |
irda-usb: add error handling and fix leak
If the call to kcalloc() fails then we should return -ENOMEM.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/irda/irda-usb.c')
-rw-r--r-- | drivers/net/irda/irda-usb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index e8e33bb9d87..2c9b3af1661 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1651,6 +1651,8 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1651 | 1651 | ||
1652 | self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *), | 1652 | self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *), |
1653 | GFP_KERNEL); | 1653 | GFP_KERNEL); |
1654 | if (!self->rx_urb) | ||
1655 | goto err_free_net; | ||
1654 | 1656 | ||
1655 | for (i = 0; i < self->max_rx_urb; i++) { | 1657 | for (i = 0; i < self->max_rx_urb; i++) { |
1656 | self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); | 1658 | self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); |
@@ -1783,6 +1785,8 @@ err_out_2: | |||
1783 | err_out_1: | 1785 | err_out_1: |
1784 | for (i = 0; i < self->max_rx_urb; i++) | 1786 | for (i = 0; i < self->max_rx_urb; i++) |
1785 | usb_free_urb(self->rx_urb[i]); | 1787 | usb_free_urb(self->rx_urb[i]); |
1788 | kfree(self->rx_urb); | ||
1789 | err_free_net: | ||
1786 | free_netdev(net); | 1790 | free_netdev(net); |
1787 | err_out: | 1791 | err_out: |
1788 | return ret; | 1792 | return ret; |