From 804e283c8b9a8ce544ef4f7b258fe5146e18adae Mon Sep 17 00:00:00 2001 From: JamesWrigley Date: Tue, 5 Dec 2023 17:55:25 +0100 Subject: [PATCH] Document that options set on a bind will be free'd by ssh_bind_free Signed-off-by: James Wrigley Reviewed-by: Jakub Jelen --- include/libssh/server.h | 3 +++ src/options.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/libssh/server.h b/include/libssh/server.h index 4033dac7..12210883 100644 --- a/include/libssh/server.h +++ b/include/libssh/server.h @@ -222,6 +222,9 @@ LIBSSH_API int ssh_server_init_kex(ssh_session session); /** * @brief Free a ssh servers bind. * + * Note that this will also free options that have been set on the bind, + * including keys set with SSH_BIND_OPTIONS_IMPORT_KEY. + * * @param ssh_bind_o The ssh server bind to free. */ LIBSSH_API void ssh_bind_free(ssh_bind ssh_bind_o); diff --git a/src/options.c b/src/options.c index 676c49e7..2727b873 100644 --- a/src/options.c +++ b/src/options.c @@ -1926,7 +1926,8 @@ static int ssh_bind_set_algo(ssh_bind sshbind, * This is DEPRECATED, please do not use. * * - SSH_BIND_OPTIONS_IMPORT_KEY: - * Set the Private Key for the server directly (ssh_key) + * Set the Private Key for the server directly + * (ssh_key). It will be free'd by ssh_bind_free(). * * - SSH_BIND_OPTIONS_CIPHERS_C_S: * Set the symmetric cipher client to server (const char *,