Subject: [ libssh2-Bugs-2795816 ] call sftp_init and sftp_shutdown twice on a session

[ libssh2-Bugs-2795816 ] call sftp_init and sftp_shutdown twice on a session

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Sat, 23 May 2009 18:06:47 +0000

Bugs item #2795816, was opened at 2009-05-23 15:23
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2795816&group_id=125852

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: SFTP
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Daniel Stenberg (bagder)
Summary: call sftp_init and sftp_shutdown twice on a session

Initial Comment:
i call libssh2_sftp_init and libssh2_sftp_shutdown for the first time, and it is ok. then i call libssh2_sftp_init on the same session, but i got an assert error:

sftp.c:566: sftp_init: Assertion `session->sftpInit_sftp == ((void *)0)' failed.

i'm using the lastest 1.1

what's the problem? the code run good on libssh2-1.0

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2009-05-23 20:06

Message:
Oh. It looks like its even a memory leak in there. How about this as a
fix:

--- a/src/sftp.c
+++ b/src/sftp.c
@@ -791,7 +791,10 @@ sftp_shutdown(LIBSSH2_SFTP *sftp)
         LIBSSH2_FREE(session, sftp->symlink_packet);
         sftp->symlink_packet = NULL;
     }
-
+ if (session->sftpInit_sftp) {
+ LIBSSH2_FREE(session, session->sftpInit_sftp);
+ session->sftpInit_sftp = NULL;
+ }
     rc = _libssh2_channel_free(sftp->channel);
 
     return rc;

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2795816&group_id=125852

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-05-23