mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-13 19:00:25 -04:00
MINOR: deinit: release the in-memory copy of shared libs
When shared libs were loaded via "set-dumpable libs", better release them upon deinit, it will make valgrind happier. For this we now have a new function free_collected_libs() in tools.c and call it in deinit().
This commit is contained in:
parent
2199053018
commit
f8fd6d25d8
3 changed files with 18 additions and 1 deletions
|
|
@ -1154,6 +1154,7 @@ void *get_sym_curr_addr(const char *name);
|
|||
void *get_sym_next_addr(const char *name);
|
||||
int dump_libs(struct buffer *output, int with_addr);
|
||||
void collect_libs(void);
|
||||
void free_collected_libs(void);
|
||||
|
||||
/* Note that this may result in opening libgcc() on first call, so it may need
|
||||
* to have been called once before chrooting.
|
||||
|
|
|
|||
|
|
@ -2956,7 +2956,7 @@ void deinit(void)
|
|||
free(init_env);
|
||||
}
|
||||
free(progname);
|
||||
|
||||
free_collected_libs();
|
||||
} /* end deinit() */
|
||||
|
||||
__attribute__((noreturn)) void deinit_and_exit(int status)
|
||||
|
|
|
|||
16
src/tools.c
16
src/tools.c
|
|
@ -6151,6 +6151,17 @@ void collect_libs(void)
|
|||
/* don't need the temporary storage anymore */
|
||||
ha_free(&ctx.storage);
|
||||
}
|
||||
|
||||
/* release memory associated to collected libs */
|
||||
void free_collected_libs(void)
|
||||
{
|
||||
if (!lib_storage || !lib_size)
|
||||
return;
|
||||
munmap(lib_storage, lib_size);
|
||||
lib_storage = NULL;
|
||||
lib_size = 0;
|
||||
}
|
||||
|
||||
# else // no DL_ITERATE_PHDR
|
||||
# error "No dump_libs() function for this platform"
|
||||
# endif
|
||||
|
|
@ -6167,6 +6178,11 @@ void collect_libs(void)
|
|||
{
|
||||
}
|
||||
|
||||
/* unsupported platform: nothing to free */
|
||||
void free_collected_libs(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif // HA_HAVE_DUMP_LIBS
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue