From 03815483be50f445e7dc267fbd1ab6d2a58826dc Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 27 Apr 2010 15:10:48 +0200 Subject: [PATCH] bugfix: potential use of NULL pointer --- example/ssh2_agent.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/example/ssh2_agent.c b/example/ssh2_agent.c index fb647657..3871c607 100644 --- a/example/ssh2_agent.c +++ b/example/ssh2_agent.c @@ -218,9 +218,11 @@ int main(int argc, char *argv[]) libssh2_agent_disconnect(agent); libssh2_agent_free(agent); - libssh2_session_disconnect(session, - "Normal Shutdown, Thank you for playing"); - libssh2_session_free(session); + if(session) { + libssh2_session_disconnect(session, + "Normal Shutdown, Thank you for playing"); + libssh2_session_free(session); + } if (sock != -1) { #ifdef WIN32