Commit 88c3422c authored by gwenn's avatar gwenn

Ensures sqlite3_close/finalize are called only once.

parent 0b10a6cd
...@@ -507,11 +507,11 @@ func (c *Conn) Close() error { ...@@ -507,11 +507,11 @@ func (c *Conn) Close() error {
} }
rv := C.sqlite3_close(c.db) rv := C.sqlite3_close(c.db)
c.db = nil
if rv != C.SQLITE_OK { if rv != C.SQLITE_OK {
Log(int(rv), "error while closing Conn") Log(int(rv), "error while closing Conn")
return c.error(rv) return c.error(rv)
} }
c.db = nil
return nil return nil
} }
......
...@@ -915,11 +915,11 @@ func (s *Stmt) finalize() error { ...@@ -915,11 +915,11 @@ func (s *Stmt) finalize() error {
return errors.New("nil sqlite statement") return errors.New("nil sqlite statement")
} }
rv := C.sqlite3_finalize(s.stmt) rv := C.sqlite3_finalize(s.stmt)
s.stmt = nil
if rv != C.SQLITE_OK { if rv != C.SQLITE_OK {
Log(int(rv), "error while finalizing Stmt") Log(int(rv), "error while finalizing Stmt")
return s.error(rv) return s.error(rv)
} }
s.stmt = nil
return nil return nil
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment