File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -254,8 +254,10 @@ where
254254 }
255255}
256256
257- /// Checks if the value is an IP address and returns a canonical representation of the address,
258- /// reallocated on the configuration pool if necessary.
257+ /// Attempts to parse the value as an IP address, returning `Some(...)` on success.
258+ ///
259+ /// The address will be converted to a canonical textual form and reallocated on the
260+ /// configuration pool if necessary.
259261fn parse_ip_identifier (
260262 cf : & ngx_conf_t ,
261263 value : & ' static str ,
@@ -281,6 +283,7 @@ fn parse_ip_identifier(
281283 out. try_reserve_exact ( buf. len ( ) ) . map_err ( |_| AllocError ) ?;
282284 out. extend_from_slice ( buf) ;
283285 // SAFETY: formatted IpAddr is always a valid ASCII string.
286+ // The buffer is owned by the ngx_pool_t and does not leak.
284287 let out = unsafe { core:: str:: from_utf8_unchecked ( out. leak ( ) ) } ;
285288
286289 Ok ( Some ( out) )
You can’t perform that action at this time.
0 commit comments