- Fix testbound for alloccheck runs, memory purify and lock checks.

This commit is contained in:
W.C.A. Wijngaards 2019-12-04 11:37:24 +01:00
parent 216747bb17
commit 6f7eb3ea9f
2 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,6 @@
4 December 2019: Wouter
- Fix lock type for memory purify log lock deletion.
- Fix testbound for alloccheck runs, memory purify and lock checks.
3 December 2019: Wouter
- Merge pull request #124 from rmetrich: Changed log lock

View File

@ -65,6 +65,23 @@
/** config files (removed at exit) */
static struct config_strlist* cfgfiles = NULL;
#ifdef UNBOUND_ALLOC_STATS
# define strdup(s) unbound_stat_strdup_log(s, __FILE__, __LINE__, __func__)
char* unbound_stat_strdup_log(char* s, const char* file, int line,
const char* func);
char* unbound_stat_strdup_log(char* s, const char* file, int line,
const char* func) {
char* result;
size_t len;
if(!s) return NULL;
len = strlen(s);
log_info("%s:%d %s strdup(%u)", file, line, func, (unsigned)len+1);
result = unbound_stat_malloc(len+1);
memmove(result, s, len+1);
return result;
}
#endif /* UNBOUND_ALLOC_STATS */
/** give commandline usage for testbound. */
static void
testbound_usage(void)
@ -463,6 +480,12 @@ main(int argc, char* argv[])
free(pass_argv[c]);
if(res == 0) {
log_info("Testbound Exit Success\n");
/* remove configfile from here, the atexit() is for when
* there is a crash to remove the tmpdir file.
* This one removes the file while alloc and log locks are
* still valid, and can be logged (for memory calculation),
* it leaves the ptr NULL so the atexit does nothing. */
remove_configfile();
if(log_get_lock()) {
lock_basic_destroy((lock_basic_type*)log_get_lock());
}