*/
#include "config.h"
#define LOCKRET(func) func
+#ifdef ENABLE_LOCK_CHECKS
+#undef ENABLE_LOCK_CHECKS
+#endif
#include "util/locks.h"
void _ARC4_LOCK(void);
void _ARC4_UNLOCK(void)
{
}
+
+void _ARC4_LOCK_DESTROY(void)
+{
+}
#else /* !THREADS_DISABLED */
static lock_quick_type arc4lock;
{
lock_quick_unlock(&arc4lock);
}
+
+void _ARC4_LOCK_DESTROY(void)
+{
+ if(arc4lockinit) {
+ arc4lockinit = 0;
+ lock_quick_destroy(&arc4lock);
+ }
+}
#endif /* THREADS_DISABLED */
void arc4random_buf(void* buf, size_t n);
void _ARC4_LOCK(void);
void _ARC4_UNLOCK(void);
+void _ARC4_LOCK_DESTROY(void);
#endif
#ifndef HAVE_ARC4RANDOM_UNIFORM
uint32_t arc4random_uniform(uint32_t upper_bound);
void arc4random_buf(void* buf, size_t n);
void _ARC4_LOCK(void);
void _ARC4_UNLOCK(void);
+void _ARC4_LOCK_DESTROY(void);
#endif
#ifndef HAVE_ARC4RANDOM_UNIFORM
uint32_t arc4random_uniform(uint32_t upper_bound);
# if defined(HAVE_SSL) && defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
ub_openssl_lock_delete();
# endif
+#ifndef HAVE_ARC4RANDOM
+ _ARC4_LOCK_DESTROY();
+#endif
#elif defined(HAVE_NSS)
NSS_Shutdown();
#endif /* HAVE_SSL or HAVE_NSS */
run_daemon(cfgfile, cmdline_verbose, debug_mode, log_ident_default, need_pidfile);
log_init(NULL, 0, NULL); /* close logfile */
+#ifndef unbound_testbound
+ if(log_get_lock()) {
+ lock_quick_destroy((lock_quick_type*)log_get_lock());
+ }
+#endif
return 0;
}
+2 February 2018: Wouter
+ - Fix unfreed locks in log and arc4random at exit of unbound.
+
1 February 2018: Wouter
- fix unaligned structure making a false positive in checklock
unitialised memory.
return 0;
}
/* check ID */
+ log_info("id wire %x, want %x", (int)LDNS_ID_WIRE(wire),
+ (int)xfr->task_transfer->id);
if(LDNS_ID_WIRE(wire) != xfr->task_transfer->id) {
verbose(VERB_ALGO, "xfr to %s failed, packet wrong ID",
xfr->task_transfer->master->host);
for(c=1; c<pass_argc; c++)
free(pass_argv[c]);
if(res == 0) {
- log_info("Testbound Exit Success");
+ log_info("Testbound Exit Success\n");
+ if(log_get_lock()) {
+ lock_quick_destroy((lock_quick_type*)log_get_lock());
+ }
#ifdef HAVE_PTHREAD
/* dlopen frees its thread state (dlopen of gost engine) */
pthread_exit(NULL);
log_time_asc = use_asc;
}
+void* log_get_lock(void)
+{
+ if(!key_created)
+ return NULL;
+ return (void*)&log_lock;
+}
+
void
log_vmsg(int pri, const char* type,
const char *format, va_list args)
*/
void log_set_time_asc(int use_asc);
+/** get log lock */
+void* log_get_lock(void);
+
/**
* Log informational message.
* Pass printf formatted arguments. No trailing newline is needed.