From 83e331e2a492a134e491bcf50c984fd50c7fae03 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Mon, 25 Sep 2006 22:31:03 -0700 Subject: [IRDA] via-ircc: fix memory leak 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 Signed-off-by: Ben Collins Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- drivers/net/irda/via-ircc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index 79b85f32750..d916e1257c4 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c @@ -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; } -- cgit v1.2.3