aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormilo <milo@r0ot.me>2011-02-20 13:53:53 +0100
committermilo <milo@r0ot.me>2011-02-20 14:35:11 +0100
commit4ee4450a6b37a099a067f6e1e9a61f566cce9247 (patch)
treebe9af7bccfb3a5bb0d77ededc49396872050c22a /src
parenta2634ceea8e121f141ecf6e283a04a9926933cc1 (diff)
downloadlibssh-4ee4450a6b37a099a067f6e1e9a61f566cce9247.tar.gz
libssh-4ee4450a6b37a099a067f6e1e9a61f566cce9247.tar.xz
libssh-4ee4450a6b37a099a067f6e1e9a61f566cce9247.zip
poll: Added a function to free an event.
Diffstat (limited to 'src')
-rw-r--r--src/poll.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/poll.c b/src/poll.c
index b79dd32..00ce404 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -727,6 +727,29 @@ ssh_event ssh_event_new(void) {
return event;
}
+/**
+ * @brief Free an event context.
+ *
+ * @param event The ssh_event object to free.
+ * Note: you have to manually remove sessions and socket
+ * fds before freeing the event object.
+ *
+ */
+void ssh_event_free(ssh_event event) {
+ if(event == NULL) {
+ return;
+ }
+ if(event->ctx != NULL) {
+ ssh_poll_ctx_free(event->ctx);
+ }
+#ifdef WITH_SERVER
+ if(event->sessions != NULL) {
+ ssh_list_free(event->sessions);
+ }
+#endif
+ free(event);
+}
+
/** @} */
/* vim: set ts=4 sw=4 et cindent: */