[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] connector: ensure channel callbacks are removed


ssh_connector_free fails to remove the in/out channel callbacks
as ssh_connector_remove_event sets the in/out channel variables
to NULL.

Have ssh_connector_free, remove the channel callbacks first before
invoking ssh_connector_remove_event.

Signed-off-by: Alberto Aguirre <albaguirre@xxxxxxxxx>
---
 src/connector.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/connector.c b/src/connector.c
index 6f15ee28..608a2fe7 100644
--- a/src/connector.c
+++ b/src/connector.c
@@ -106,6 +106,15 @@ ssh_connector ssh_connector_new(ssh_session session)
 
 void ssh_connector_free (ssh_connector connector)
 {
+    if (connector->in_channel != NULL) {
+        ssh_remove_channel_callbacks(connector->in_channel,
+                                     &connector->in_channel_cb);
+    }
+    if (connector->out_channel != NULL) {
+        ssh_remove_channel_callbacks(connector->out_channel,
+                                     &connector->out_channel_cb);
+    }
+
     if (connector->event != NULL){
         ssh_connector_remove_event(connector);
     }
@@ -120,15 +129,6 @@ void ssh_connector_free (ssh_connector connector)
         connector->out_poll = NULL;
     }
 
-    if (connector->in_channel != NULL) {
-        ssh_remove_channel_callbacks(connector->in_channel,
-                                     &connector->in_channel_cb);
-    }
-    if (connector->out_channel != NULL) {
-        ssh_remove_channel_callbacks(connector->out_channel,
-                                     &connector->out_channel_cb);
-    }
-
     free(connector);
 }
 
-- 
2.14.1


Archive administrator: postmaster@lists.cynapses.org