mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-05-30 05:24:50 +03:00
examples: Fix a possible memory leak.
This commit is contained in:
parent
abb25861e5
commit
de4cb811a0
@ -307,10 +307,13 @@ static int main_loop(ssh_channel chan) {
|
|||||||
}
|
}
|
||||||
if(ssh_event_add_fd(event, fd, events, copy_fd_to_chan, chan) != SSH_OK) {
|
if(ssh_event_add_fd(event, fd, events, copy_fd_to_chan, chan) != SSH_OK) {
|
||||||
printf("Couldn't add an fd to the event\n");
|
printf("Couldn't add an fd to the event\n");
|
||||||
|
ssh_event_free(event);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(ssh_event_add_session(event, session) != SSH_OK) {
|
if(ssh_event_add_session(event, session) != SSH_OK) {
|
||||||
printf("Couldn't add the session to the event\n");
|
printf("Couldn't add the session to the event\n");
|
||||||
|
ssh_event_remove_fd(event, fd);
|
||||||
|
ssh_event_free(event);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user