NFC: avoid freeing unallocated memory
Issue: In function ese_cold_reset_ioctl, kfree is getting call for nfc_dev->cold_reset.cmd_buf in case of early failure in the function. Fix: Add check NULL check before calling kfree Change-Id: Ic3e86494f65330ff58a0deb394b3a654f0a395db Signed-off-by: Om Prakash Singh <quic_omprsing@quicinc.com>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
27989fc132
commit
fe2e65e65f
@@ -392,10 +392,14 @@ int ese_cold_reset_ioctl(struct nfc_dev *nfc_dev, unsigned long arg)
|
||||
ret = nfc_dev->cold_reset.status;
|
||||
|
||||
err:
|
||||
kfree(nfc_dev->cold_reset.cmd_buf);
|
||||
nfc_dev->cold_reset.cmd_buf = NULL;
|
||||
kfree(cold_reset_arg);
|
||||
cold_reset_arg = NULL;
|
||||
if (nfc_dev->cold_reset.cmd_buf != NULL) {
|
||||
kfree(nfc_dev->cold_reset.cmd_buf);
|
||||
nfc_dev->cold_reset.cmd_buf = NULL;
|
||||
}
|
||||
if (cold_reset_arg != NULL) {
|
||||
kfree(cold_reset_arg);
|
||||
cold_reset_arg = NULL;
|
||||
}
|
||||
|
||||
mutex_unlock(&nfc_dev->write_mutex);
|
||||
|
||||
|
Reference in New Issue
Block a user