From 1e4a0134e6ed6d455e54cd21f64232389280781b Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 22 Mar 2025 11:55:11 +1100 Subject: [PATCH] Remove unnecessary null pointer check (#6370) Further pointed out by @elfring, this patch removes one more unnecessary null pointer check. https://github.com/meshtastic/firmware/issues/6170#issuecomment-2744002798 --- src/mesh/CryptoEngine.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mesh/CryptoEngine.cpp b/src/mesh/CryptoEngine.cpp index 6dffbe2b7..d32b73855 100644 --- a/src/mesh/CryptoEngine.cpp +++ b/src/mesh/CryptoEngine.cpp @@ -223,10 +223,8 @@ void CryptoEngine::decrypt(uint32_t fromNode, uint64_t packetId, size_t numBytes // Generic implementation of AES-CTR encryption. void CryptoEngine::encryptAESCtr(CryptoKey _key, uint8_t *_nonce, size_t numBytes, uint8_t *bytes) { - if (ctr) { - delete ctr; - ctr = nullptr; - } + delete ctr; + ctr = nullptr; if (_key.length == 16) ctr = new CTR(); else