mISDN: fix possible memory leak in hfcmulti_init()
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 <yongjun_wei@trendmicro.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
b379135c40
commit
9fef76857f
@@ -5059,6 +5059,7 @@ hfcmulti_init(struct hm_map *m, struct pci_dev *pdev,
|
|||||||
printk(KERN_INFO
|
printk(KERN_INFO
|
||||||
"HFC-E1 #%d has overlapping B-channels on fragment #%d\n",
|
"HFC-E1 #%d has overlapping B-channels on fragment #%d\n",
|
||||||
E1_cnt + 1, pt);
|
E1_cnt + 1, pt);
|
||||||
|
kfree(hc);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
maskcheck |= hc->bmask[pt];
|
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)) {
|
if ((poll >> 1) > sizeof(hc->silence_data)) {
|
||||||
printk(KERN_ERR "HFCMULTI error: silence_data too small, "
|
printk(KERN_ERR "HFCMULTI error: silence_data too small, "
|
||||||
"please fix\n");
|
"please fix\n");
|
||||||
|
kfree(hc);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
for (i = 0; i < (poll >> 1); i++)
|
for (i = 0; i < (poll >> 1); i++)
|
||||||
|
Reference in New Issue
Block a user