/ View Ticket
Check-in [d3c95e3a4e08d0] was incorrect. This is the correct fix for sqlit3_bind_blob(). Ticket [860399cc408f2dd5f4] (check-in: ea8c2f5f user: drh tags: trunk)
02:13 Fixed ticket [860399cc]: Potential memory leak in sqlite3_bind_text() plus 2 other changes (artifact: 55002588 user: drh)
Fix the sqlite3_bind_blob() interface (and its kin) so that the destructor is invoked if the binding fails. Ticket [860399cc408f2dd5f41aed44b] Update the documentation to explain which interfaces invoke their destructors on failure and which do not. (check-in: d3c95e3a user: drh tags: trunk)
19:06 New ticket [860399cc] Potential memory leak in sqlite3_bind_text(). (artifact: 3b888a90 user: drh)

Ticket Hash: 860399cc408f2dd5f41aed44bc4d3296f2755ef9
Title: Potential memory leak in sqlite3_bind_text()
Status: Fixed Type: Code_Defect
Severity: Minor Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2010-10-12 02:13:48
Version Found In: 3.7.3
In the following C interfaces:
  • sqlite3_bind_blob()
  • sqlite3_bind_text()
  • sqlite3_bind_text16()

SQLite promises to take responsibility for invoking the destructor on the bound string or blob once that string or blob is no longer needed. However, this sometimes does not happen if the bind interface call itself fails. For example, the destructor is called on an SQLITE_TOOBIG error but is omitted on an SQLITE_RANGE error. The interfaces should be consistent and always invoke the destructor regardless of the error.