mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
libssh port: backported sftp_server_free
sftp_server_free function was added in 0.9 version of libssh and is required to avoid memory leaks when clients are disconnecting. Issue #4258
This commit is contained in:
parent
f327a40bbb
commit
6ef6f16cb3
@ -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
|
||||
|
@ -1 +1 @@
|
||||
41048c9e30b72f70e68fad3806ce1a756178e713
|
||||
32ea34e5e531845ea1b155620b7685c668a9851d
|
||||
|
@ -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
|
||||
|
51
repos/libports/src/lib/libssh/sftp_server_free.patch
Normal file
51
repos/libports/src/lib/libssh/sftp_server_free.patch
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user