Skip to content
Snippets Groups Projects
Commit abedbd40 authored by rswindell's avatar rswindell
Browse files

Fixed memory leak if server stopped and re-started.

parent daff53cf
No related branches found
No related tags found
No related merge requests found
...@@ -2240,6 +2240,8 @@ void DLLCALL mail_terminate(void) ...@@ -2240,6 +2240,8 @@ void DLLCALL mail_terminate(void)
static void cleanup(int code) static void cleanup(int code)
{ {
free_cfg(&scfg);
if(server_socket!=INVALID_SOCKET) { if(server_socket!=INVALID_SOCKET) {
mail_close_socket(server_socket); mail_close_socket(server_socket);
server_socket=INVALID_SOCKET; server_socket=INVALID_SOCKET;
...@@ -2333,6 +2335,8 @@ void DLLCALL mail_server(void* arg) ...@@ -2333,6 +2335,8 @@ void DLLCALL mail_server(void* arg)
status("Initializing"); status("Initializing");
memset(&scfg, 0, sizeof(scfg));
#ifdef __unix__ /* Ignore "Broken Pipe" signal */ #ifdef __unix__ /* Ignore "Broken Pipe" signal */
signal(SIGPIPE,SIG_IGN); signal(SIGPIPE,SIG_IGN);
#endif #endif
...@@ -2376,7 +2380,6 @@ void DLLCALL mail_server(void* arg) ...@@ -2376,7 +2380,6 @@ void DLLCALL mail_server(void* arg)
,ctime(&t),startup->options); ,ctime(&t),startup->options);
/* Initial configuration and load from CNF files */ /* Initial configuration and load from CNF files */
memset(&scfg, 0, sizeof(scfg));
sprintf(scfg.ctrl_dir, "%.*s", (int)sizeof(scfg.ctrl_dir)-1 sprintf(scfg.ctrl_dir, "%.*s", (int)sizeof(scfg.ctrl_dir)-1
,startup->ctrl_dir); ,startup->ctrl_dir);
lprintf("Loading configuration files from %s", scfg.ctrl_dir); lprintf("Loading configuration files from %s", scfg.ctrl_dir);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment