[IRDA] via-ircc: fix memory leak
authorChuck Short <zulcss@gmail.com>
Tue, 26 Sep 2006 05:31:03 +0000 (22:31 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 29 Sep 2006 00:53:55 +0000 (17:53 -0700)
Fix memory leak.

Coverity id# 653

patch location:
http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=a1f34cb68b16807ed9d5ebb0f6a6ec5ff8a5fc78

Signed-off-by: Chuck Short <zulcss@gmail.com>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/irda/via-ircc.c

index 79b85f327500c4e553bccf2c69007d2e22e89468..d916e1257c471d8df1c14e172f9a25963a2c00b8 100644 (file)
@@ -1223,8 +1223,13 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
 
        IRDA_DEBUG(2, "%s(): len=%x\n", __FUNCTION__, len);
 
+       if ((len - 4) < 2) {
+               self->stats.rx_dropped++;
+               return FALSE;
+       }
+
        skb = dev_alloc_skb(len + 1);
-       if ((skb == NULL) || ((len - 4) < 2)) {
+       if (skb == NULL) {
                self->stats.rx_dropped++;
                return FALSE;
        }