1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-29 13:01:14 +03:00

Fix resource and memory leaks in examples as reported by cppcheck

Thanks to Ettl Martin for the report and patch. This fixes #132
This commit is contained in:
Peter Stuge
2010-02-16 13:14:03 +01:00
parent a491017f5a
commit 2149244cfe
4 changed files with 15 additions and 6 deletions

View File

@ -184,12 +184,10 @@ int main(int argc, char *argv[])
} while (rc > 0);
} while (1);
fclose(local);
libssh2_sftp_close(sftp_handle);
libssh2_sftp_shutdown(sftp_session);
shutdown:
shutdown:
libssh2_session_disconnect(session,
"Normal Shutdown, Thank you for playing");
libssh2_session_free(session);
@ -199,6 +197,8 @@ int main(int argc, char *argv[])
#else
close(sock);
#endif
printf("all done\n");
if (local)
fclose(local);
printf("all done\n");
return 0;
}