Hello,
When i set a webserver with SSL, valgrinf reports there are memory leaks.
Here my patch on example 1
diff --git a/examples/1_basic/example.cc b/examples/1_basic/example.cc
index d7ca051..b0702ed 100644
--- a/examples/1_basic/example.cc
+++ b/examples/1_basic/example.cc
@@ -77,9 +77,9 @@ int main()
webServer = new WebServer;
webServer->setServerPort(8080);
-//webServer->setThreadsPoolSize(1);
+webServer->setThreadsPoolSize(4);
//uncomment to switch to https
-//webServer->setUseSSL(true, "mycert.pem");
+webServer->setUseSSL(true, "/home/jcourtat/myCert.pem");
//uncomment to active X509 auth
//webServer->setAuthPeerSSL(true, "cachain.pem");
And here is the valgrind command invocation:
valgrind --leak-check=yes ./example
==6583==
==6583== HEAP SUMMARY:
==6583== in use at exit: 97,511 bytes in 2,932 blocks
==6583== total heap usage: 7,277 allocs, 4,345 frees, 1,521,590 bytes allocated
==6583==
==6583== 2,432 bytes in 4 blocks are possibly lost in loss record 251 of 259
==6583== at 0x4C2A975: calloc (vg_replace_malloc.c:711)
==6583== by 0x4011F94: _dl_allocate_tls (in /usr/lib64/ld-2.17.so)
==6583== by 0x60FC960: pthread_create@@GLIBC_2.2.5 (in /usr/lib64/libpthread-2.17.so)
==6583== by 0x4050BC: create_thread(unsigned long*, void* ()(void), void*, bool, unsigned long) (in /home/jcourtat/dev/src/github.com/libnavajo/examples/1_basic/example)
==6583== by 0x4E43D43: WebServer::initPoolThreads() (WebServer.cc:1449)
==6583== by 0x4E46C83: WebServer::threadProcessing() (WebServer.cc:1488)
==6583== by 0x4E47AD8: WebServer::startThread(void*) (WebServer.cc:1465)
==6583== by 0x60FBDC4: start_thread (in /usr/lib64/libpthread-2.17.so)
==6583== by 0x640776C: clone (in /usr/lib64/libc-2.17.so)
==6583==
==6583== 3,808 (1,568 direct, 2,240 indirect) bytes in 14 blocks are definitely lost in loss record 256 of 259
==6583== at 0x4C28BE3: malloc (vg_replace_malloc.c:299)
==6583== by 0x5552592: CRYPTO_malloc (in /usr/lib64/libcrypto.so.1.0.1e)
==6583== by 0x55C2A2E: BIO_new (in /usr/lib64/libcrypto.so.1.0.1e)
==6583== by 0x4E4C0D7: WebServer::poolThreadProcessing() (WebServer.cc:1416)
==6583== by 0x4E529C8: WebServer::startPoolThread(void*) (WebServer.hh:71)
==6583== by 0x60FBDC4: start_thread (in /usr/lib64/libpthread-2.17.so)
==6583== by 0x640776C: clone (in /usr/lib64/libc-2.17.so)
==6583==
==6583== LEAK SUMMARY:
==6583== definitely lost: 1,568 bytes in 14 blocks
==6583== indirectly lost: 2,240 bytes in 28 blocks
==6583== possibly lost: 2,432 bytes in 4 blocks
==6583== still reachable: 91,271 bytes in 2,886 blocks
==6583== of which reachable via heuristic:
==6583== stdstring : 119 bytes in 2 blocks
==6583== suppressed: 0 bytes in 0 blocks
==6583== Reachable blocks (those to which a pointer was found) are not shown.
==6583== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==6583==
==6583== For counts of detected and suppressed errors, rerun with: -v
==6583== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
i created connection to the webserver this way:
curl -k https://127.0.0.1:8080
regards
Julien