NFC: add NULL checks to avoid potential NULL pointer dereference
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Tue, 30 May 2017 20:43:07 +0000 (15:43 -0500)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 22 Jun 2017 22:34:56 +0000 (00:34 +0200)
commit6f874bafacf053b87887f4149fc117e2b1096138
tree741c3b62f5a3001684a941948966e3890fcefe54
parent03036184e9d4a5b2b42a70b66db9455808dd5da9
NFC: add NULL checks to avoid potential NULL pointer dereference

NULL checks at line 457: if (!link0 || !link1) {, implies that both
pointers link0 and link1 might be NULL.
Function nfcsim_link_free() dereference pointers link0 and link1.
Add NULL checks before calling nfcsim_link_free() to avoid a
potential NULL pointer dereference.

Addresses-Coverity-ID: 1364857
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/nfcsim.c