[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix leak of sftp->ext when sftp_new() fails


Signed-off-by: Kevin Fan <kevinfan@xxxxxxxxxx>

diff --git a/src/sftp.c b/src/sftp.c
index d64d0ee..bd4a4b5 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -126,6 +126,7 @@ sftp_session sftp_new(ssh_session session){
   sftp->session = session;
   sftp->channel = ssh_channel_new(session);
   if (sftp->channel == NULL) {
+    sftp_ext_free(sftp->ext);
     SAFE_FREE(sftp);

     return NULL;
@@ -133,6 +134,7 @@ sftp_session sftp_new(ssh_session session){

   if (ssh_channel_open_session(sftp->channel)) {
     ssh_channel_free(sftp->channel);
+    sftp_ext_free(sftp->ext);
     SAFE_FREE(sftp);

     return NULL;

Archive administrator: postmaster@lists.cynapses.org