]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Avoid calling log functions in logv when SMARTLIST_DEBUG is defined
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>
Fri, 5 Feb 2016 03:14:17 +0000 (14:14 +1100)
committerteor (Tim Wilson-Brown) <teor2345@gmail.com>
Fri, 5 Feb 2016 03:14:17 +0000 (14:14 +1100)
src/common/log.c

index f71583fd63006770ba7455398d3a44dd082d519d..477975154389e8dacc749129ca0d85ec2d1ca664 100644 (file)
@@ -490,7 +490,8 @@ logv,(int severity, log_domain_mask_t domain, const char *funcname,
   assert(log_mutex_initialized);
   LOCK_LOGS();
 
-  if ((! (domain & LD_NOCB)) && smartlist_len(pending_cb_messages))
+  if ((! (domain & LD_NOCB)) && pending_cb_messages
+      && smartlist_len(pending_cb_messages))
     flush_pending_log_callbacks();
 
   if (queue_startup_messages &&
@@ -945,7 +946,7 @@ flush_pending_log_callbacks(void)
   smartlist_t *messages, *messages_tmp;
 
   LOCK_LOGS();
-  if (0 == smartlist_len(pending_cb_messages)) {
+  if (!pending_cb_messages || 0 == smartlist_len(pending_cb_messages)) {
     UNLOCK_LOGS();
     return;
   }