mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 12:10:53 +03:00
tpws: fix cleanup in resolver_init
This commit is contained in:
parent
a760745452
commit
d13e9cb092
@ -181,12 +181,12 @@ bool resolver_init(int threads, int fd_signal_pipe)
|
|||||||
|
|
||||||
|
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
if (pthread_attr_init(&attr)) goto ex1;
|
if (pthread_attr_init(&attr)) goto ex2;
|
||||||
// set minimum thread stack size
|
// set minimum thread stack size
|
||||||
if (pthread_attr_setstacksize(&attr,20480))
|
if (pthread_attr_setstacksize(&attr,20480))
|
||||||
{
|
{
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
goto ex1;
|
goto ex2;
|
||||||
}
|
}
|
||||||
for(t=0, resolver.threads=threads ; t<threads ; t++)
|
for(t=0, resolver.threads=threads ; t<threads ; t++)
|
||||||
{
|
{
|
||||||
@ -197,15 +197,12 @@ bool resolver_init(int threads, int fd_signal_pipe)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
if (!resolver.threads)
|
if (!resolver.threads) goto ex2;
|
||||||
{
|
|
||||||
// could not start any threads
|
|
||||||
free(resolver.thread);
|
|
||||||
goto ex1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
ex2:
|
||||||
|
free(resolver.thread);
|
||||||
ex1:
|
ex1:
|
||||||
pthread_mutex_destroy(&resolver.resolve_list_lock);
|
pthread_mutex_destroy(&resolver.resolve_list_lock);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user