From b44f3a0cb3a0e26e5585137a4be5f89e5c61869f Mon Sep 17 00:00:00 2001 From: Cyril Gaudin Date: Fri, 19 Aug 2022 19:56:25 +0200 Subject: [PATCH] fix: Missing err check that led to segfault (#242) cf #183 --- postgresql/resource_postgresql_database.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/postgresql/resource_postgresql_database.go b/postgresql/resource_postgresql_database.go index 3d6068d0..9cc9da55 100644 --- a/postgresql/resource_postgresql_database.go +++ b/postgresql/resource_postgresql_database.go @@ -125,6 +125,9 @@ func createDatabase(db *DBConnection, d *schema.ResourceData) error { // Take a lock on db currentUser to avoid multiple database creation at the same time // It can fail if they grant the same owner to current at the same time as it's not done in transaction. lockTxn, err := startTransaction(db.client, "") + if err != nil { + return err + } if err := pgLockRole(lockTxn, currentUser); err != nil { return err }