rob05c closed pull request #2376: Add missing Close() deferral after DB queries
URL: https://github.com/apache/incubator-trafficcontrol/pull/2376
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/traffic_ops/traffic_ops_golang/physlocation/trimmed.go
b/traffic_ops/traffic_ops_golang/physlocation/trimmed.go
index 15f293e3c..99f0b5b59 100644
--- a/traffic_ops/traffic_ops_golang/physlocation/trimmed.go
+++ b/traffic_ops/traffic_ops_golang/physlocation/trimmed.go
@@ -39,6 +39,7 @@ func getTrimmed(db *sql.DB) ([]tc.PhysLocationTrimmed, error)
{
if err != nil {
return nil, errors.New("querying trimmed physical locations: "
+ err.Error())
}
+ defer rows.Close()
ps := []tc.PhysLocationTrimmed{}
for rows.Next() {
name := ""
diff --git a/traffic_ops/traffic_ops_golang/profile/trimmed.go
b/traffic_ops/traffic_ops_golang/profile/trimmed.go
index 114dcbe42..adb2e89d3 100644
--- a/traffic_ops/traffic_ops_golang/profile/trimmed.go
+++ b/traffic_ops/traffic_ops_golang/profile/trimmed.go
@@ -20,8 +20,8 @@ package profile
*/
import (
- "errors"
"database/sql"
+ "errors"
"net/http"
"github.com/apache/incubator-trafficcontrol/lib/go-tc"
@@ -39,6 +39,7 @@ func getTrimmedProfiles(db *sql.DB) ([]tc.ProfileTrimmed,
error) {
if err != nil {
return nil, errors.New("querying trimmed profiles: " +
err.Error())
}
+ defer rows.Close()
profiles := []tc.ProfileTrimmed{}
for rows.Next() {
name := ""
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services