pthread_attr_destroy added to prevent memory leak on config reload

This commit is contained in:
z3APA3A 2017-09-13 22:05:38 +03:00
parent ff9c94f616
commit 2554f06759
2 changed files with 4 additions and 0 deletions

View File

@ -161,6 +161,7 @@ int start_proxy_thread(struct child * chp){
pthread_attr_setstacksize(&pa,PTHREAD_STACK_MIN + (16384+conf.stacksize)); pthread_attr_setstacksize(&pa,PTHREAD_STACK_MIN + (16384+conf.stacksize));
pthread_attr_setdetachstate(&pa,PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&pa,PTHREAD_CREATE_DETACHED);
pthread_create(&thread, &pa, startsrv, (void *)chp); pthread_create(&thread, &pa, startsrv, (void *)chp);
pthread_attr_destroy(&pa);
#endif #endif
while(conf.threadinit)usleep(SLEEPTIME); while(conf.threadinit)usleep(SLEEPTIME);
if(haveerror) { if(haveerror) {

View File

@ -830,6 +830,9 @@ int MODULEMAINFUNC (int argc, char** argv){
pthread_mutex_unlock(&config_mutex); pthread_mutex_unlock(&config_mutex);
#endif #endif
#ifndef _WIN32
pthread_attr_destroy(&pa);
#endif
if(defparam.hostname)myfree(defparam.hostname); if(defparam.hostname)myfree(defparam.hostname);
if(cbc_string)myfree(cbc_string); if(cbc_string)myfree(cbc_string);
if(cbl_string)myfree(cbl_string); if(cbl_string)myfree(cbl_string);