int colourise; //!< Messages output to stderr and
//!< stdout may be formatted using
//!< VT100 escape sequences.
+ int debug_memory;
} MAIN_CONFIG_T;
/* DEBUG is defined below */
this = talloc_get_type_abort(ctx, module_entry_t);
- lt_dlclose(this->handle); /* ignore any errors */
+#ifndef NDEBUG
+ /*
+ * Don't dlclose() modules if we're doing memory
+ * debugging. This removes the symbols needed by
+ * valgrind.
+ */
+ if (!mainconfig.debug_memory)
+#endif
+ lt_dlclose(this->handle); /* ignore any errors */
return 0;
}
pid_t radius_pid;
-static int debug_memory = 0;
-
/*
* Configuration items.
*/
break;
case 'm':
- debug_memory = 1;
+ mainconfig.debug_memory = 1;
break;
case 'M':
memory_report = 1;
- debug_memory = 1;
+ mainconfig.debug_memory = 1;
break;
case 'p':
* server to die immediately. Use SIGTERM to shut down
* the server cleanly in that case.
*/
- if ((debug_memory == 1) || (debug_flag == 0)) {
+ if ((mainconfig.debug_memory == 1) || (debug_flag == 0)) {
#ifdef HAVE_SIGACTION
act.sa_handler = sig_fatal;
sigaction(SIGINT, &act, NULL);
#ifdef SIGQUIT
case SIGQUIT:
#endif
- if (debug_memory || memory_report) {
+ if (mainconfig.debug_memory || memory_report) {
radius_signal_self(RADIUS_SIGNAL_SELF_TERM);
break;
}
node = talloc_get_type_abort(ctx, EAP_TYPES);
if (node->type->detach) (node->type->detach)(node->type_data);
- if (node->handle) lt_dlclose(node->handle);
+
+#ifndef NDEBUG
+ /*
+ * Don't dlclose() modules if we're doing memory
+ * debugging. This removes the symbols needed by
+ * valgrind.
+ */
+ if (!mainconfig.debug_memory)
+#endif
+ if (node->handle) lt_dlclose(node->handle);
return 0;
}