I'm using Civetweb in a windows application built in Visual Studio 2013. I'm seeing a memory leak dump when the application exits if I provide a SSL certificate path in the options list to the CivetServer's constructor.
I can reproduce this in the sample provided in examples\embedded_cpp\embedded_cpp.cpp if I make the following changes:
int main(int argc, char *argv[])
{
const char * options[] = { "document_root", DOCUMENT_ROOT,
"listening_ports", "8081,8083s",
"ssl_certificate", "c:\\server.pem", 0 // Provide an SSL cert
};
/* CivetServer instance is now created on the heap */
CivetServer* server = new CivetServer (options);
ExampleHandler h_ex;
server->addHandler(EXAMPLE_URI, h_ex);
ExitHandler h_exit;
server->addHandler(EXIT_URI, h_exit);
AHandler h_a;
server->addHandler("/a", h_a);
ABHandler h_ab;
server->addHandler("/a/b", h_ab);
FooHandler h_foo;
server->addHandler("**.foo$", h_foo);
printf("Browse files at http://localhost:%s/\n", PORT);
printf("Run example at http://localhost:%s%s\n", PORT, EXAMPLE_URI);
printf("Exit at http://localhost:%s%s\n", PORT, EXIT_URI);
while (!exitNow) {
#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
#endif
}
printf("Bye!\n");
delete server;
return 0;
}
Note that I do not see the leak of the instance of CivetServer is created on the stack. Any ideas as to why this is the case? Do I need to clean up the certificate some how before destroying the CivetServer?