mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 09:07:02 +02: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()
|
static void free_trash_buffers_per_thread()
|
||||||
{
|
{
|
||||||
chunk_destroy(&trash);
|
chunk_destroy(&trash);
|
||||||
free(trash_buf2);
|
ha_free(&trash_buf2);
|
||||||
free(trash_buf1);
|
ha_free(&trash_buf1);
|
||||||
trash_buf2 = NULL;
|
|
||||||
trash_buf1 = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the trash buffers. It returns 0 if an error occurred. */
|
/* 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_ALLOC(alloc_trash_buffers_per_thread);
|
||||||
REGISTER_PER_THREAD_FREE(free_trash_buffers_per_thread);
|
REGISTER_PER_THREAD_FREE(free_trash_buffers_per_thread);
|
||||||
|
REGISTER_POST_DEINIT(free_trash_buffers_per_thread);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
|
Loading…
Reference in New Issue
Block a user