diff --git a/repos/libports/lib/symbols/libssh b/repos/libports/lib/symbols/libssh index 11736bed27..fdb3948530 100644 --- a/repos/libports/lib/symbols/libssh +++ b/repos/libports/lib/symbols/libssh @@ -57,6 +57,7 @@ sftp_rmdir T sftp_seek T sftp_seek64 T sftp_send_client_message T +sftp_server_free T sftp_server_init T sftp_server_new T sftp_server_version T diff --git a/repos/libports/ports/libssh.hash b/repos/libports/ports/libssh.hash index 704b3e3dce..03cfbff8c4 100644 --- a/repos/libports/ports/libssh.hash +++ b/repos/libports/ports/libssh.hash @@ -1 +1 @@ -41048c9e30b72f70e68fad3806ce1a756178e713 +32ea34e5e531845ea1b155620b7685c668a9851d diff --git a/repos/libports/ports/libssh.port b/repos/libports/ports/libssh.port index c3907bfcc0..1a591112f6 100644 --- a/repos/libports/ports/libssh.port +++ b/repos/libports/ports/libssh.port @@ -9,5 +9,7 @@ DIR(libssh) := src/lib/libssh DIRS := include DIR_CONTENT(include) := src/lib/libssh/include/libssh -PATCHES := src/lib/libssh/event_bind.patch src/lib/libssh/sftp_support.patch +PATCHES := src/lib/libssh/event_bind.patch \ + src/lib/libssh/sftp_support.patch \ + src/lib/libssh/sftp_server_free.patch PATCH_OPT := -p1 -d src/lib/libssh diff --git a/repos/libports/src/lib/libssh/sftp_server_free.patch b/repos/libports/src/lib/libssh/sftp_server_free.patch new file mode 100644 index 0000000000..c6763d9aef --- /dev/null +++ b/repos/libports/src/lib/libssh/sftp_server_free.patch @@ -0,0 +1,51 @@ +--- a/include/libssh/sftp.h 2021-07-04 21:26:20.445524952 +0200 ++++ b/include/libssh/sftp.h 2021-07-04 20:19:16.752749814 +0200 +@@ -854,6 +854,13 @@ + * @return 0 on success, < 0 on error. + */ + LIBSSH_API int sftp_server_init(sftp_session sftp); ++ ++/** ++ * @brief Close and deallocate a sftp server session. ++ * ++ * @param sftp The sftp session handle to free. ++ */ ++LIBSSH_API void sftp_server_free(sftp_session sftp); + #endif /* WITH_SERVER */ + + /* this is not a public interface */ +--- a/src/sftp.c 2021-07-04 21:26:20.445524952 +0200 ++++ b/src/sftp.c 2021-07-04 20:18:14.310652966 +0200 +@@ -299,6 +299,32 @@ + + return 0; + } ++ ++void sftp_server_free(sftp_session sftp) ++{ ++ sftp_request_queue ptr; ++ ++ if (sftp == NULL) { ++ return; ++ } ++ ++ ptr = sftp->queue; ++ while(ptr) { ++ sftp_request_queue old; ++ sftp_message_free(ptr->message); ++ old = ptr->next; ++ SAFE_FREE(ptr); ++ ptr = old; ++ } ++ ++ SAFE_FREE(sftp->handles); ++ SSH_BUFFER_FREE(sftp->read_packet->payload); ++ SAFE_FREE(sftp->read_packet); ++ ++ sftp_ext_free(sftp->ext); ++ ++ SAFE_FREE(sftp); ++} + #endif /* WITH_SERVER */ + + void sftp_free(sftp_session sftp)