NFC: st21nfcb: double free on allocation error
Subsystems (2)
PATCH 1/1 NFC: st21nfcb: double free on allocation error
"info" is allocated with devm_kzalloc() so calling kfree() here will lead to a double free.
Signed-off-by Dan Carpenter <[email protected]>
drivers/nfc/st21nfcb/st21nfcb.c +1 -4
@@ -94,8 +94,7 @@ int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, phy_headroom, phy_tailroom);if (!ndlc->ndev) {pr_err ("Cannot allocate nfc ndev\n" ); - r = -ENOMEM ; - goto err_alloc_ndev; +return -ENOMEM ; } info->ndlc = ndlc;
@@ -109,8 +108,6 @@ int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, err_regdev:nci_free_device (ndlc->ndev); -err_alloc_ndev: -kfree (info);return r; }EXPORT_SYMBOL_GPL (st21nfcb_nci_probe);