avoid calling new/malloc in signalhandler.
authorFumitoshi Ukai <ukai@google.com>
Thu, 17 Dec 2015 06:26:15 +0000 (15:26 +0900)
committerFumitoshi Ukai <ukai@google.com>
Thu, 17 Dec 2015 06:26:15 +0000 (15:26 +0900)
FlushLogFilesUnsafe would be called in FailureSignalHandler,
so should avoid calling new/malloc, which are not signal safe.

fixes #78

src/logging.cc

index b7c2f4c..982a308 100644 (file)
@@ -572,7 +572,7 @@ inline void LogDestination::FlushLogFilesUnsafe(int min_severity) {
   // assume we have the log_mutex or we simply don't care
   // about it
   for (int i = min_severity; i < NUM_SEVERITIES; i++) {
-    LogDestination* log = log_destination(i);
+    LogDestination* log = log_destinations_[i];
     if (log != NULL) {
       // Flush the base fileobject_ logger directly instead of going
       // through any wrappers to reduce chance of deadlock.