| 
					
				 | 
			
			
				@@ -1898,6 +1898,10 @@ extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         extrainfo->nickname, identity, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         published, bandwidth_usage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  tor_free(bandwidth_usage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (result<0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (options->ExtraInfoStatistics && write_stats_to_extrainfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     char *contents = NULL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     log_info(LD_GENERAL, "Adding stats to extra-info descriptor."); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1910,6 +1914,7 @@ extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log_warn(LD_DIR, "Could not write dirreq-stats to extra-info " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  "descriptor."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         s[pos] = '\0'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        write_stats_to_extrainfo = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       tor_free(contents); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1922,6 +1927,7 @@ extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log_warn(LD_DIR, "Could not write entry-stats to extra-info " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  "descriptor."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         s[pos] = '\0'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        write_stats_to_extrainfo = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       tor_free(contents); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1934,6 +1940,7 @@ extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log_warn(LD_DIR, "Could not write buffer-stats to extra-info " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  "descriptor."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         s[pos] = '\0'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        write_stats_to_extrainfo = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       tor_free(contents); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1946,17 +1953,14 @@ extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log_warn(LD_DIR, "Could not write exit-stats to extra-info " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  "descriptor."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         s[pos] = '\0'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        write_stats_to_extrainfo = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       tor_free(contents); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  tor_free(bandwidth_usage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  if (result<0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  if (should_record_bridge_info(options)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    char *bridge_stats = geoip_get_bridge_stats_extrainfo(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (should_record_bridge_info(options) && write_stats_to_extrainfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const char *bridge_stats = geoip_get_bridge_stats_extrainfo(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (bridge_stats) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       size_t pos = strlen(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (strlcpy(s + pos, bridge_stats, maxlen - strlen(s)) != 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1964,8 +1968,8 @@ extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log_warn(LD_DIR, "Could not write bridge-stats to extra-info " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  "descriptor."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         s[pos] = '\0'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        write_stats_to_extrainfo = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      tor_free(bridge_stats); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |