Skip to content

Commit 03b18c6

Browse files
committed
Check for a valid pointer before calling 'delete' is not necessary since 'delete' can handle a NULL value
1 parent c354b6e commit 03b18c6

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/ArduinoIoTCloudTCP.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,9 @@ ArduinoIoTCloudTCP::ArduinoIoTCloudTCP():
6262
_otaTopic("")
6363
{}
6464

65-
6665
ArduinoIoTCloudTCP::~ArduinoIoTCloudTCP() {
67-
if (_mqttClient) {
68-
delete _mqttClient;
69-
_mqttClient = NULL;
70-
}
71-
72-
if (_sslClient) {
73-
delete _sslClient;
74-
_sslClient = NULL;
75-
}
66+
delete _mqttClient; _mqttClient = NULL;
67+
delete _sslClient; _sslClient = NULL;
7668
}
7769

7870
int ArduinoIoTCloudTCP::begin(ConnectionHandler & connection, String brokerAddress, uint16_t brokerPort) {

0 commit comments

Comments
 (0)