[PATCH] mISDN: fix possible memory leak in hfcmulti_init()

Subsystems: the rest

STALE5092d

2 messages, 2 authors, 2012-09-03 · open the first message on its own page

[PATCH] mISDN: fix possible memory leak in hfcmulti_init()

From: Wei Yongjun <hidden>
Date: 2012-09-03 07:31:01

From: Wei Yongjun <redacted>

hc has been allocated in this function and missing free it before
leaving from some error handling cases.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <redacted>
---
 drivers/isdn/hardware/mISDN/hfcmulti.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index 5e402cf..f027942 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -5059,6 +5059,7 @@ hfcmulti_init(struct hm_map *m, struct pci_dev *pdev,
 				printk(KERN_INFO
 				       "HFC-E1 #%d has overlapping B-channels on fragment #%d\n",
 				       E1_cnt + 1, pt);
+				kfree(hc);
 				return -EINVAL;
 			}
 			maskcheck |= hc->bmask[pt];
@@ -5086,6 +5087,7 @@ hfcmulti_init(struct hm_map *m, struct pci_dev *pdev,
 	if ((poll >> 1) > sizeof(hc->silence_data)) {
 		printk(KERN_ERR "HFCMULTI error: silence_data too small, "
 		       "please fix\n");
+		kfree(hc);
 		return -EINVAL;
 	}
 	for (i = 0; i < (poll >> 1); i++)

Re: [PATCH] mISDN: fix possible memory leak in hfcmulti_init()

From: David Miller <davem@davemloft.net>
Date: 2012-09-03 19:37:59

From: Wei Yongjun <redacted>
Date: Mon, 3 Sep 2012 15:31:00 +0800
From: Wei Yongjun <redacted>

hc has been allocated in this function and missing free it before
leaving from some error handling cases.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <redacted>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help