fix memory leak
Change-Id: Ibfa3c8e06208bbc8e90efcaca1d4dc6121bb89e1
diff --git a/src/protocol-detail/enc-tlv.cpp b/src/protocol-detail/enc-tlv.cpp
index 68319c2..3515adc 100644
--- a/src/protocol-detail/enc-tlv.cpp
+++ b/src/protocol-detail/enc-tlv.cpp
@@ -37,8 +37,8 @@
iv.resize(12);
random::generateSecureBytes(iv.data(), iv.size());
- uint8_t* encryptedPayload = new uint8_t[payloadSize];
- uint8_t* tag = new uint8_t[16];
+ uint8_t encryptedPayload[payloadSize];
+ uint8_t tag[16];
size_t encryptedPayloadLen = aes_gcm_128_encrypt(payload, payloadSize, associatedData, associatedDataSize,
key, iv.data(), encryptedPayload, tag);
auto content = makeEmptyBlock(tlv_type);