Skip to content

Commit

Permalink
mISDN: fix possible memory leak in hfcmulti_init()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Wei Yongjun authored and davem330 committed Sep 3, 2012
1 parent b379135 commit 9fef768
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/isdn/hardware/mISDN/hfcmulti.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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++)
Expand Down

0 comments on commit 9fef768

Please sign in to comment.