mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
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@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
25f31760aa
commit
85ab4ee53a
@@ -106,6 +106,15 @@ ssh_connector ssh_connector_new(ssh_session session)
|
|||||||
|
|
||||||
void ssh_connector_free (ssh_connector connector)
|
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){
|
if (connector->event != NULL){
|
||||||
ssh_connector_remove_event(connector);
|
ssh_connector_remove_event(connector);
|
||||||
}
|
}
|
||||||
@@ -120,15 +129,6 @@ void ssh_connector_free (ssh_connector connector)
|
|||||||
connector->out_poll = NULL;
|
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);
|
free(connector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user