internal/postgres: close prepared statement in InsertVersion

stmt.Close() is called to free any resources used to create a prepared
statement for inserting packages inside postgres.InsertVersion.

Change-Id: I84ca3128af503b343f0b7f811090ddd8cb9226ab
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/440425
Reviewed-by: Andrew Bonventre <andybons@google.com>
This commit is contained in:
Julie Qiu 2019-03-27 16:58:13 -04:00
Родитель 18e6a51c96
Коммит e3aae5f686
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -388,6 +388,7 @@ func (db *DB) InsertVersion(version *internal.Version) error {
if err != nil {
return fmt.Errorf("error preparing package stmt: %v", err)
}
defer stmt.Close()
for _, p := range version.Packages {
if _, err = stmt.Exec(p.Path, p.Synopsis, p.Name, version.Version, version.Module.Path, version.VersionType.String()); err != nil {