Commit 1ce3334a authored by gwenn's avatar gwenn

Ensure prepared statement is finalized when an error occurs.

parent 5161414c
......@@ -100,6 +100,7 @@ func (c *Conn) prepare(sql string, args ...interface{}) (*Stmt, error) {
// If the caller knows that the supplied string is nul-terminated, then there is a small performance advantage to be gained by passing an nByte parameter that is equal to the number of bytes in the input string including the nul-terminator bytes as this saves SQLite from having to make a copy of the input string.
rv := C.sqlite3_prepare_v2(c.db, sqlstr, C.int(len(sql)+1), &stmt, &tail)
if rv != C.SQLITE_OK {
C.sqlite3_finalize(stmt)
return nil, c.error(rv, sql)
}
var t string
......
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