memory leak just for ssh_new() and ssh_free()
Using library in windows 11 environment there is a memory leak after release allocated session from ssh_new(). Version is: 0.10.90
Sample code:
int main(int argc, char** argv) {
ssh_session session;
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
_CrtMemState s1, s2, s3;
_CrtMemCheckpoint(&s1);
session = ssh_new();
ssh_free(session);
_CrtMemCheckpoint(&s2);
if (_CrtMemDifference(&s3, &s1, &s2))
_CrtMemDumpStatistics(&s3);
return 0;
}
Output log:
The thread 0x443c has exited with code 0 (0x0).
0 bytes in 0 Free Blocks.
**232 bytes in 6 Normal Blocks.**
0 bytes in 0 CRT Blocks.
0 bytes in 0 Ignore Blocks.
0 bytes in 0 Client Blocks.
Largest number used: 2644 bytes.
Total allocations: 2644 bytes.
'SshServerTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'.
The thread 0x23b8 has exited with code 0 (0x0).
The thread 0x2808 has exited with code 0 (0x0).
Detected memory leaks!
Dumping objects ->
{119} normal block at 0x00774E80, 64 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
{118} normal block at 0x0077D400, 20 bytes long.
Data: < @ > 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00
{117} normal block at 0x007758A0, 64 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
{116} normal block at 0x0077D3C0, 20 bytes long.
Data: < @ > 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00
{115} normal block at 0x00776090, 48 bytes long.
Data: < > FF FF FF FF 01 00 00 00 FF FF FF FF 00 00 00 00
{114} normal block at 0x0077D380, 16 bytes long.
Data: < `w > 90 60 77 00 00 00 00 00 00 00 00 00 00 00 00 00
Object dump complete.
The program '[19524] SshServerTest.exe' has exited with code 0 (0x0).
Please note that any couple of call: session = ssh_new(); ssh_free(session);
creates 6 blocks of memory leaks BR Angelo
Edited by Angelo Macchiavello