summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libssh/agent.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libssh/agent.c b/libssh/agent.c
index 10d6678..e098f10 100644
--- a/libssh/agent.c
+++ b/libssh/agent.c
@@ -136,6 +136,10 @@ AGENT *agent_new(struct ssh_session *session) {
}
void agent_close(struct agent_struct *agent) {
+ if (agent == NULL) {
+ return;
+ }
+
if (getenv("SSH_AUTH_SOCK")) {
ssh_socket_close(agent->sock);
}