1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-28 01:41:48 +03:00

examples: Call correct functions on exit.

This commit is contained in:
Andreas Schneider
2011-04-14 14:16:58 +02:00
parent cee8ca339b
commit 3e7d4534ce
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;
}