From 5b369d672e35d95740dd3d24f8d69ea08fb7741c Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 5 Dec 2020 06:34:49 +0100 Subject: Only free gcm context after all packets were sent --- sender.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sender.c b/sender.c index c56cb8c..d940e17 100644 --- a/sender.c +++ b/sender.c @@ -53,8 +53,6 @@ void send_udp(int sock, mbedtls_ctr_drbg_context *ctr_drbg, const uint8_t *text, output + 1 + SESSION_ID_LENGTH + GCM_IV_LENGTH)) { sendto(sock, output, total_length, 0, (struct sockaddr*)&logging_host_address, logging_host_address_len); } - - mbedtls_gcm_free(&ctx); } void new_session(int sock, mbedtls_ctr_drbg_context *ctr_drbg) { @@ -120,5 +118,6 @@ int main() { send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); + mbedtls_gcm_free(&ctx); close(sock); } -- cgit v1.2.3