aboutsummaryrefslogtreecommitdiff
path: root/sqlite3.go
diff options
context:
space:
mode:
authorPhilip O'Toole <philip.otoole@yahoo.com>2018-08-30 05:44:58 -0700
committerPhilip O'Toole <philip.otoole@yahoo.com>2018-08-30 05:47:34 -0700
commitabfacf568407f0fa384f75cac134b4ebd9cf33ec (patch)
treeb5687d3f1683c3931c501d2449b2d258d0999877 /sqlite3.go
parentMerge pull request #621 from AndrewMurrell/master (diff)
downloadgolite-abfacf568407f0fa384f75cac134b4ebd9cf33ec.tar.gz
golite-abfacf568407f0fa384f75cac134b4ebd9cf33ec.tar.xz
Fix data race in AutoCommit()
Detected via https://circleci.com/gh/rqlite/rqlite/2223.
Diffstat (limited to 'sqlite3.go')
-rw-r--r--sqlite3.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/sqlite3.go b/sqlite3.go
index d8c5b8d..e48594f 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -648,6 +648,8 @@ func (c *SQLiteConn) RegisterAggregator(name string, impl interface{}, pure bool
// AutoCommit return which currently auto commit or not.
func (c *SQLiteConn) AutoCommit() bool {
+ c.mu.Lock()
+ defer c.mu.Unlock()
return int(C.sqlite3_get_autocommit(c.db)) != 0
}