aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/security/signer.cc
diff options
context:
space:
mode:
authorOlivier Roques <oroques+fdio@cisco.com>2020-03-11 14:20:22 +0100
committerOlivier Roques <oroques+fdio@cisco.com>2020-03-11 14:21:40 +0100
commitc564dd5c456de2d27b43cb3888d998e814abba57 (patch)
tree0c50a0d3a69baafe954057d3b6a7a7964ee4d043 /libtransport/src/security/signer.cc
parent23657bc8a770734a74f73f6d07075130a366ef00 (diff)
[HICN-546] Fix memory leak on producer side
Fix a memory leak caused during the signing of packets on the producer side by releasing the signature when signing is done. Change-Id: I352885913e3a16d03fcc77116238928edb090e01 Signed-off-by: Olivier Roques <oroques+fdio@cisco.com>
Diffstat (limited to 'libtransport/src/security/signer.cc')
-rw-r--r--libtransport/src/security/signer.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/libtransport/src/security/signer.cc b/libtransport/src/security/signer.cc
index 314c3ea82..8a56cfa3d 100644
--- a/libtransport/src/security/signer.cc
+++ b/libtransport/src/security/signer.cc
@@ -162,12 +162,10 @@ void Signer::sign(Packet &packet) {
}
CryptoHash hash = hasher.finalize();
-
signature_ = parcSigner_SignDigestNoAlloc(this->signer_, hash.hash_,
packet.getSignature(),
(uint32_t)signature_length_);
PARCBuffer *buffer = parcSignature_GetSignature(signature_);
-
size_t bytes_len = parcBuffer_Remaining(buffer);
if (bytes_len > signature_length_) {
@@ -176,6 +174,8 @@ void Signer::sign(Packet &packet) {
hicn_packet_copy_header(format, &header_copy,
(hicn_header_t *)packet.packet_start_, false);
+
+ parcSignature_Release(&signature_);
}
size_t Signer::getSignatureLength() { return signature_length_; }