File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9797 run : |
9898 git log -3
9999 sudo ./run_all_sshd_tests.sh
100+
101+ # could use optimization with caching
102+ - name : Test memory after close down
103+ working-directory : ./wolfssh/
104+ run : |
105+ sudo apt-get install valgrind
106+ touch sshd_config.txt
107+ ./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120" --enable-static --disable-shared && make
108+ sudo timeout --preserve-status -s 2 5 valgrind --error-exitcode=1 --leak-check=full ./apps/wolfsshd/wolfsshd -D -f sshd_config -h ./keys/server-key.pem -d -p 22222
Original file line number Diff line number Diff line change @@ -2468,9 +2468,11 @@ static int StartSSHD(int argc, char** argv)
24682468 struct sockaddr_in6 clientAddr ;
24692469 socklen_t clientAddrSz = sizeof (clientAddr );
24702470#endif
2471- conn = (WOLFSSHD_CONNECTION * )WMALLOC (sizeof (WOLFSSHD_CONNECTION ), NULL , DYNTYPE_SSHD );
2471+ conn = (WOLFSSHD_CONNECTION * )WMALLOC (sizeof (WOLFSSHD_CONNECTION ),
2472+ NULL , DYNTYPE_SSHD );
24722473 if (conn == NULL ) {
2473- wolfSSH_Log (WS_LOG_ERROR , "[SSHD] Failed to malloc memory for connection" );
2474+ wolfSSH_Log (WS_LOG_ERROR ,
2475+ "[SSHD] Failed to malloc memory for connection" );
24742476 break ;
24752477 }
24762478
@@ -2536,9 +2538,13 @@ static int StartSSHD(int argc, char** argv)
25362538 }
25372539 ret = NewConnection (conn );
25382540 }
2541+ else {
2542+ XFREE (conn , NULL , DYNTYPE_SSHD );
2543+ }
25392544#ifdef _WIN32
25402545 /* check if service has been shutdown */
2541- if (isDaemon && WaitForSingleObject (serviceStop , 0 ) == WAIT_OBJECT_0 ) {
2546+ if (isDaemon && WaitForSingleObject (serviceStop , 0 ) ==
2547+ WAIT_OBJECT_0 ) {
25422548 quit = 1 ;
25432549 }
25442550#endif
You can’t perform that action at this time.
0 commit comments