+In Go, defer schedules a function call to run when the enclosing function
+returns — not when the enclosing block or loop iteration ends. Deferring a resource release
+call (such as Close, Unlock, or Rollback) inside a loop
+means that cleanup calls accumulate and only execute after the loop finishes and the function
+returns.
+
+This can lead to resource exhaustion: file descriptors pile up, database connections are held +open, locks are held longer than intended, or transactions remain open across iterations. +
+ +
+Extract the loop body into a separate function or closure so that defer runs
+at the end of each iteration:
+
+Alternatively, call the cleanup function directly without defer at the
+appropriate point in the loop body.
+
+Reading an HTTP request body with io.ReadAll (or the deprecated
+ioutil.ReadAll) allocates the entire body into memory with no upper bound.
+A malicious client can send an arbitrarily large request body to exhaust server memory,
+causing a denial-of-service condition.
+
+Wrap the request body with a size-limiting reader before reading it: +
+ +
+Prefer http.MaxBytesReader which also sets the appropriate error on the
+response, or io.LimitReader for non-HTTP contexts.
+