| 
					
				 | 
			
			
				@@ -136,6 +136,10 @@ tor_gzip_compress(char **out, size_t *out_len, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  done: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   *out_len = stream->total_out; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (stream->total_out > out_size + 4097) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /* If we're wasting more than 4k, don't. */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    tor_realloc(*out, stream->total_out + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (deflateEnd(stream)!=Z_OK) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     log_warn(LD_BUG, "Error freeing gzip structures"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     goto err; 
			 |