fix thread leak, gota detach

This commit is contained in:
jsorg71 2005-02-17 01:38:32 +00:00
parent aafcaa6a56
commit 97b2519fd4
3 changed files with 11 additions and 3 deletions

View File

@ -590,8 +590,11 @@ int g_thread_create(unsigned long (__stdcall * start_routine)(void*), void* arg)
int g_thread_create(void* (* start_routine)(void*), void* arg)
{
pthread_t thread;
int rv;
return pthread_create(&thread, 0, start_routine, arg);
rv = pthread_create(&thread, 0, start_routine, arg);
pthread_detach(thread);
return rv;
}
#endif

View File

@ -139,7 +139,8 @@ int xrdp_listen_main_loop(struct xrdp_listen* self)
self->status = 1;
self->sck = g_tcp_socket();
g_tcp_set_non_blocking(self->sck);
if (g_tcp_bind(self->sck, "3389") != 0)
error = g_tcp_bind(self->sck, "3389");
if (error != 0)
{
g_printf("bind error in xrdp_listen_main_loop\n\r");
g_tcp_close(self->sck);
@ -178,7 +179,7 @@ int xrdp_listen_main_loop(struct xrdp_listen* self)
}
else
{
DEBUG(("error, listener done\n\r"));
DEBUG(("listen error in xrdp_listen_main_loop\n\r"));
}
xrdp_listen_term_processes(self);
g_tcp_close(self->sck);

View File

@ -39,6 +39,10 @@ struct xrdp_orders* xrdp_orders_create(struct xrdp_process* owner,
/*****************************************************************************/
void xrdp_orders_delete(struct xrdp_orders* self)
{
if (self == 0)
{
return;
}
free_stream(self->out_s);
g_free(self);
}