mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-16 10:40:58 +00:00
CLEANUP: chunks: release trash also in deinit
Tim reported in issue #1676 that just like startup_logs, trash buffers are not released on deinit since they're thread-local, but valgrind notices it when quitting before creating threads like "-c -f ...". Let's just subscribe the function to deinit in addition to threads' end. The two "free(x);x=NULL;" in free_trash_buffers_per_thread() were also simplified using ha_free().
This commit is contained in:
parent
032e700e8b
commit
d941146583
@ -82,10 +82,8 @@ static int alloc_trash_buffers_per_thread()
|
||||
static void free_trash_buffers_per_thread()
|
||||
{
|
||||
chunk_destroy(&trash);
|
||||
free(trash_buf2);
|
||||
free(trash_buf1);
|
||||
trash_buf2 = NULL;
|
||||
trash_buf1 = NULL;
|
||||
ha_free(&trash_buf2);
|
||||
ha_free(&trash_buf1);
|
||||
}
|
||||
|
||||
/* Initialize the trash buffers. It returns 0 if an error occurred. */
|
||||
@ -309,6 +307,7 @@ int chunk_strcasecmp(const struct buffer *chk, const char *str)
|
||||
|
||||
REGISTER_PER_THREAD_ALLOC(alloc_trash_buffers_per_thread);
|
||||
REGISTER_PER_THREAD_FREE(free_trash_buffers_per_thread);
|
||||
REGISTER_POST_DEINIT(free_trash_buffers_per_thread);
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
|
Loading…
Reference in New Issue
Block a user