Skip to content

Commit 6b303a7

Browse files
Azim Khan0xc0170
authored andcommitted
Conditionally delete I2C pointer
1 parent 4ecc3d9 commit 6b303a7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

features/atcryptoauth/MbedPlatform.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ ATCAError MbedPlatform::Init()
3535

3636
void MbedPlatform::Deinit()
3737
{
38+
#if defined(DEVICE_I2C)
3839
if (i2c != NULL)
3940
delete i2c;
41+
#endif
4042
i2c = NULL;
4143
}
4244

features/atcryptoauth/MbedPlatform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ class MbedPlatform : public ATCAPlatformInterface {
4343
}
4444

4545
virtual ~MbedPlatform() {
46+
#if defined(DEVICE_I2C)
4647
if (i2c != NULL)
4748
delete i2c;
49+
#endif
4850
}
4951

5052
/** Initialize I2C.

0 commit comments

Comments
 (0)