1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-07 08:02:55 +03:00

examples: Call correct functions on exit.

(cherry picked from commit 3e7d4534ce)
This commit is contained in:
Andreas Schneider
2011-04-14 14:16:58 +02:00
parent a309c1b38e
commit 1b44daddf6
2 changed files with 9 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ int main(void) {
session = connect_ssh("localhost", NULL, 0);
if (session == NULL) {
ssh_finalize();
return 1;
}
@@ -20,6 +21,7 @@ int main(void) {
if (channel == NULL) {
ssh_disconnect(session);
ssh_free(session);
ssh_finalize();
return 1;
}
@@ -49,6 +51,7 @@ int main(void) {
ssh_channel_close(channel);
ssh_channel_free(channel);
ssh_free(session);
ssh_finalize();
return 0;
failed:
@@ -56,6 +59,7 @@ failed:
ssh_channel_free(channel);
ssh_disconnect(session);
ssh_free(session);
ssh_finalize();
return 1;
}