mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix lock debug code for gcc sanitizer reports.
This commit is contained in:
parent
7d70e3c861
commit
a64cbe958d
7 changed files with 38 additions and 4 deletions
|
|
@ -210,7 +210,6 @@ daemon_init(void)
|
|||
}
|
||||
#endif /* USE_WINSOCK */
|
||||
signal_handling_record();
|
||||
checklock_start();
|
||||
#ifdef HAVE_SSL
|
||||
# ifdef HAVE_ERR_LOAD_CRYPTO_STRINGS
|
||||
ERR_load_crypto_strings();
|
||||
|
|
|
|||
|
|
@ -781,6 +781,7 @@ main(int argc, char* argv[])
|
|||
int cmdline_cfg = 0;
|
||||
#endif
|
||||
|
||||
checklock_start();
|
||||
log_init(NULL, 0, NULL);
|
||||
log_ident_default = strrchr(argv[0],'/')?strrchr(argv[0],'/')+1:argv[0];
|
||||
log_ident_set_default(log_ident_default);
|
||||
|
|
|
|||
|
|
@ -1264,9 +1264,9 @@ int main(int argc, char** argv)
|
|||
memset(&tls_list, 0, sizeof(tls_list));
|
||||
|
||||
/* lock debug start (if any) */
|
||||
checklock_start();
|
||||
log_ident_set("unbound-dnstap-socket");
|
||||
log_init(0, 0, 0);
|
||||
checklock_start();
|
||||
|
||||
#ifdef SIGPIPE
|
||||
if(signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
10 September 2021: Wouter
|
||||
- Fix initialisation errors reported by gcc sanitizer.
|
||||
- Fix lock debug code for gcc sanitizer reports.
|
||||
|
||||
8 September 2021: Wouter
|
||||
- Merged #41 from Moritz Schneider: made outbound-msg-retry
|
||||
|
|
|
|||
|
|
@ -909,9 +909,9 @@ int main(int argc, char* argv[])
|
|||
const char* f;
|
||||
const char* opt = NULL;
|
||||
const char* cfgfile = CONFIGFILE;
|
||||
checklock_start();
|
||||
log_ident_set("unbound-checkconf");
|
||||
log_init(NULL, 0, NULL);
|
||||
checklock_start();
|
||||
#ifdef USE_WINSOCK
|
||||
/* use registry config file in preference to compiletime location */
|
||||
if(!(cfgfile=w_lookup_reg_str("Software\\Unbound", "ConfigFile")))
|
||||
|
|
|
|||
|
|
@ -944,9 +944,9 @@ int main(int argc, char* argv[])
|
|||
extern int check_locking_order;
|
||||
check_locking_order = 0;
|
||||
#endif /* USE_THREAD_DEBUG */
|
||||
checklock_start();
|
||||
log_ident_set("unbound-control");
|
||||
log_init(NULL, 0, NULL);
|
||||
checklock_start();
|
||||
#ifdef USE_WINSOCK
|
||||
/* use registry config file in preference to compiletime location */
|
||||
if(!(cfgfile=w_lookup_reg_str("Software\\Unbound", "ConfigFile")))
|
||||
|
|
|
|||
|
|
@ -387,6 +387,37 @@ static void check_order(rbtree_type* all_locks)
|
|||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/** delete lock ref */
|
||||
static void dellockref(rbnode_type* node, void* ATTR_UNUSED(arg))
|
||||
{
|
||||
struct lock_ref* o = (struct lock_ref*)node;
|
||||
if(!o) return;
|
||||
free(o->file);
|
||||
free(o);
|
||||
}
|
||||
|
||||
/** delete lock node */
|
||||
static void delnode(rbnode_type* node, void* ATTR_UNUSED(arg))
|
||||
{
|
||||
struct order_lock* o = (struct order_lock*)node;
|
||||
if(!o) return;
|
||||
free(o->create_file);
|
||||
if(o->smaller) {
|
||||
traverse_postorder(o->smaller, &dellockref, NULL);
|
||||
free(o->smaller);
|
||||
}
|
||||
free(o);
|
||||
}
|
||||
|
||||
/** delete allocated memory */
|
||||
static void locks_free(rbtree_type* all_locks)
|
||||
{
|
||||
if(!all_locks)
|
||||
return;
|
||||
traverse_postorder(all_locks, &delnode, NULL);
|
||||
free(all_locks);
|
||||
}
|
||||
|
||||
/** main program to verify all traces passed */
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
|
|
@ -403,6 +434,7 @@ main(int argc, char* argv[])
|
|||
usage();
|
||||
return 1;
|
||||
}
|
||||
checklock_start();
|
||||
log_init(NULL, 0, NULL);
|
||||
log_ident_set("lock-verify");
|
||||
/* init */
|
||||
|
|
@ -421,6 +453,7 @@ main(int argc, char* argv[])
|
|||
printf("checked %d locks in %d seconds with %d errors.\n",
|
||||
(int)all_locks->count, (int)(time(NULL)-starttime),
|
||||
errors_detected);
|
||||
locks_free(all_locks);
|
||||
if(errors_detected) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue