From 07c22c6708bd4c651cfd0fd5dd4cd75a28cbdd25 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Fri, 23 Jun 2023 23:19:40 +0100 Subject: [PATCH 1/2] Reword the description of mbedtls_net_free() This makes it clearer that the context itself is not being freed. Signed-off-by: David Horstmann --- include/mbedtls/net_sockets.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mbedtls/net_sockets.h b/include/mbedtls/net_sockets.h index 14316fbed..9f9e2adcf 100644 --- a/include/mbedtls/net_sockets.h +++ b/include/mbedtls/net_sockets.h @@ -283,16 +283,16 @@ int mbedtls_net_recv_timeout(void *ctx, unsigned char *buf, size_t len, uint32_t timeout); /** - * \brief Closes down the connection and free associated data + * \brief Close down the connection and clear the context * * \param ctx The context to close */ void mbedtls_net_close(mbedtls_net_context *ctx); /** - * \brief Gracefully shutdown the connection and free associated data + * \brief Gracefully shutdown the connection and clear the context * - * \param ctx The context to free + * \param ctx The context to gracefully shutdown */ void mbedtls_net_free(mbedtls_net_context *ctx); From 4506e7de616d221c184cd0f9c5b14d2f4d06b71f Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Tue, 27 Jun 2023 12:20:32 +0100 Subject: [PATCH 2/2] Move clarification to a separate note Signed-off-by: David Horstmann --- include/mbedtls/net_sockets.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/mbedtls/net_sockets.h b/include/mbedtls/net_sockets.h index 9f9e2adcf..1096d66d9 100644 --- a/include/mbedtls/net_sockets.h +++ b/include/mbedtls/net_sockets.h @@ -283,16 +283,24 @@ int mbedtls_net_recv_timeout(void *ctx, unsigned char *buf, size_t len, uint32_t timeout); /** - * \brief Close down the connection and clear the context + * \brief Closes down the connection and free associated data * * \param ctx The context to close + * + * \note This function frees and clears data associated with the + * context but does not free the memory pointed to by \p ctx. + * This memory is the responsibility of the caller. */ void mbedtls_net_close(mbedtls_net_context *ctx); /** - * \brief Gracefully shutdown the connection and clear the context + * \brief Gracefully shutdown the connection and free associated data * - * \param ctx The context to gracefully shutdown + * \param ctx The context to free + * + * \note This function frees and clears data associated with the + * context but does not free the memory pointed to by \p ctx. + * This memory is the responsibility of the caller. */ void mbedtls_net_free(mbedtls_net_context *ctx);