memory leak when bchannel_sendata return -EBUSY

Martin Bachem <[email protected]>
Newsgroups gmane.linux.isdn.i4l.user
Message-ID <[email protected]>
Hi Karsten,

just wondering if I just spotted a memleak... What do you think?
This is found in several layer1 drivers all the same, so I'm curious
what you think about this.

cheers, Martin


-- 

<--------------------------------------------------------------->
< Cologne Chip AG             +  The ISDN Chip Company!         >
<                             +                                 >
< Eintrachtstr. 113           +  Phone: +49-221-9124-0          >
<                             +  Fax  : +49-221-9124-100        >
< 50668 Koeln                 +                                 >
<                             +  Email: [email protected]    >
< Germany                     +  Web  : www.colognechip.com     >
<--------------------------------------------------------------->

Vorsitzender des Aufsichtsrates: Hermann-Josef Kirschbaum
Vertretungsberechtigter Vorstand: Dr. Michael Gude (Vorsitz),
Joerg Ciesielski, Harald Schaefer, Klaus Winterscheidt
Registergericht: Amtsgericht Koeln, HRB 33457

_______________________________________________
isdn4linux mailing list
[email protected]
https://www.isdn4linux.de/mailman/listinfo/isdn4linux
0001-memleak.patch (text/x-patch, 1.2 KB)
From 9baac21390838c78a48fbb98dc066abba4b34a81 Mon Sep 17 00:00:00 2001
From: Martin Bachem <[email protected]>
Date: Tue, 27 May 2014 17:50:23 +0200
Subject: [PATCH] memleak?

---
 drivers/isdn/hardware/mISDN/avmfritz.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c
index 292991c..b22a014 100644
--- a/drivers/isdn/hardware/mISDN/avmfritz.c
+++ b/drivers/isdn/hardware/mISDN/avmfritz.c
@@ -702,12 +702,15 @@ avm_l2l1B(struct mISDNchannel *ch, struct sk_buff *skb)
 	case PH_DATA_REQ:
 		spin_lock_irqsave(&fc->lock, flags);
 		ret = bchannel_senddata(bch, skb);
+		if (ret < 0) {
+			dev_kfree_skb(skb);
+		}
 		if (ret > 0) { /* direct TX */
 			hdlc_fill_fifo(bch);
 			ret = 0;
 		}
 		spin_unlock_irqrestore(&fc->lock, flags);
-		return ret;
+		break;
 	case PH_ACTIVATE_REQ:
 		spin_lock_irqsave(&fc->lock, flags);
 		if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags))
@@ -729,8 +732,6 @@ avm_l2l1B(struct mISDNchannel *ch, struct sk_buff *skb)
 		ret = 0;
 		break;
 	}
-	if (!ret)
-		dev_kfree_skb(skb);
 	return ret;
 }
 
-- 
2.0.0.rc2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.