From 81433cfaf48820189e05814377a35ec09d5e38d0 Mon Sep 17 00:00:00 2001 From: Aaron L Date: Sun, 14 Aug 2016 18:36:22 -0700 Subject: [PATCH] Not freeing rows objects. --- bdb/drivers/postgres.go | 3 ++- boil/reflect.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bdb/drivers/postgres.go b/bdb/drivers/postgres.go index 472e54c..2c8341b 100644 --- a/bdb/drivers/postgres.go +++ b/bdb/drivers/postgres.go @@ -138,8 +138,8 @@ func (p *PostgresDriver) Columns(tableName string) ([]bdb.Column, error) { if err != nil { return nil, err } - defer rows.Close() + for rows.Next() { var colName, colType, colDefault, nullable string var unique bool @@ -195,6 +195,7 @@ func (p *PostgresDriver) PrimaryKeyInfo(tableName string) (*bdb.PrimaryKey, erro if rows, err = p.dbConn.Query(queryColumns, pkey.Name); err != nil { return nil, err } + defer rows.Close() var columns []string for rows.Next() { diff --git a/boil/reflect.go b/boil/reflect.go index 1fdb44a..a7ecb68 100644 --- a/boil/reflect.go +++ b/boil/reflect.go @@ -91,6 +91,7 @@ func bind(q *Query, obj interface{}, structType, sliceType reflect.Type, singula if err != nil { return errors.Wrap(err, "bind failed to execute query") } + defer rows.Close() cols, err := rows.Columns() if err != nil {