From 7fef4e32a1952e70b9457dbe49804e8c61cc3e58 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Wed, 29 Jun 2016 23:11:43 +0200
Subject: [PATCH] conn: don't free easy handle data in handler->disconnect

Reported-by: Gou Lingfeng
Bug: https://curl.haxx.se/mail/lib-2016-06/0139.html
---
 lib/smb.c | 1 -
 lib/ssh.c | 4 ----
 2 files changed, 5 deletions(-)

diff --git a/lib/smb.c b/lib/smb.c
index 2ddbb20..56a38c2 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -903,11 +903,10 @@ static CURLcode smb_disconnect(struct connectdata *conn, bool dead)
   Curl_safefree(smbc->recv_buf);
 
   /* smb_done is not always called, so cleanup the request */
   if(req) {
     Curl_safefree(req->share);
-    Curl_safefree(conn->data->req.protop);
   }
 
   return CURLE_OK;
 }
 
diff --git a/lib/ssh.c b/lib/ssh.c
index e72b756..7bc3136 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -3055,12 +3055,10 @@ static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection)
 {
   CURLcode result = CURLE_OK;
   struct ssh_conn *ssh = &conn->proto.sshc;
   (void) dead_connection;
 
-  Curl_safefree(conn->data->req.protop);
-
   if(ssh->ssh_session) {
     /* only if there's a session still around to use! */
 
     state(conn, SSH_SESSION_DISCONNECT);
 
@@ -3218,12 +3216,10 @@ static CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection)
   CURLcode result = CURLE_OK;
   (void) dead_connection;
 
   DEBUGF(infof(conn->data, "SSH DISCONNECT starts now\n"));
 
-  Curl_safefree(conn->data->req.protop);
-
   if(conn->proto.sshc.ssh_session) {
     /* only if there's a session still around to use! */
     state(conn, SSH_SFTP_SHUTDOWN);
     result = ssh_block_statemach(conn, FALSE);
   }
-- 
2.8.1

