Ticket #104 (closed defect)
Error using custom allocator in libssh2_session_init_ex
|Reported by:||markmcpherson||Owned by:||bagder|
The libssh2_session_init_ex allows you to specify custom memory allocation functions and a void *abstract arg. These functions are supposed to be called passing a ptr to the original abstract ptr arg (i.e. void abstract).
However, on the very first call, they are passed the abstract ptr itself rather than the doubly dereferenced pointer. This causes allocation code that utilizes that ptr to crash.
The source code for libssh2_session_init_ex includes the following:
session = local_alloc(sizeof(LIBSSH2_SESSION), abstract);
This should probably be changed to read
session = local_alloc(sizeof(LIBSSH2_SESSION), &abstract);