#define RDEBUG4 DEBUG4
#endif
+void log_talloc(const char *message);
+void log_talloc_report(TALLOC_CTX *ctx);
+
#define SECONDS_PER_DAY 86400
#define MAX_REQUEST_TIME 30
#define CLEANUP_DELAY 5
va_end(ap);
}
+
+void log_talloc(const char *msg)
+{
+ radlog(L_INFO, "%s", msg);
+}
+
+void log_talloc_report(TALLOC_CTX *ctx)
+{
+ struct main_config_t *myconfig = &mainconfig;
+ FILE *fd;
+
+ fd = fdopen(myconfig->radlog_fd, "w");
+ if (!fd) {
+ radlog(L_ERR, "Couldn't write memory report, fdopen failed: %s",
+ strerror(errno));
+
+ return;
+ }
+ radlog(L_INFO, "Allocated memory at time of report:");
+ talloc_report_full(ctx, fd);
+
+ fclose(fd);
+}
int log_stripped_names;
int debug_flag = 0;
int check_config = FALSE;
+int memory_report = FALSE;
const char *radiusd_version = "FreeRADIUS Version " RADIUSD_VERSION_STRING
#ifdef RADIUSD_VERSION_COMMIT
mainconfig.log_file = NULL;
/* Process the options. */
- while ((argval = getopt(argc, argv, "Cd:fhi:l:mn:p:stvxX")) != EOF) {
+ while ((argval = getopt(argc, argv, "Cd:fhi:l:mMn:p:stvxX")) != EOF) {
switch(argval) {
case 'C':
debug_memory = 1;
break;
+ case 'M':
+ memory_report = 1;
+ break;
+
case 'p':
mainconfig.port = atoi(optarg);
if ((mainconfig.port <= 0) ||
}
}
+ if (memory_report) {
+ talloc_enable_null_tracking();
+ talloc_set_log_fn(log_talloc);
+ }
+
/*
* Mismatch between build time OpenSSL and linked SSL,
* better to die here than segfault later.
WSACleanup();
#endif
+ if (memory_report) {
+ log_talloc_report(NULL);
+ }
+
return (rcode - 1);
}
#ifdef SIGQUIT
case SIGQUIT:
#endif
- if (debug_memory) {
+ if (debug_memory || memory_report) {
radius_signal_self(RADIUS_SIGNAL_SELF_TERM);
break;
}