Fix crash in sftp_close_handle.

Don't free dir handle data when it's not a dir handle!
This commit is contained in:
Sara Golemon 2004-12-24 03:49:25 +00:00
parent 3f24fb005e
commit 6f13a93be9
2 changed files with 7 additions and 1 deletions

5
README
View File

@ -1,6 +1,11 @@
libssh2 - SSH2 library
======================
Version 0.4
-----------
Fixed crash when trying to free sftp_dirhandle data from a filehandle struct.
Version 0.3
-----------

View File

@ -950,7 +950,8 @@ LIBSSH2_API int libssh2_sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle)
handle->next->prev = NULL;
}
if (handle->u.dir.names_left) {
if ((handle->handle_type == LIBSSH2_SFTP_HANDLE_DIR) &&
handle->u.dir.names_left) {
LIBSSH2_FREE(session, handle->u.dir.names_packet);
}