/ Check-in [d6684d2a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In sqlite3_bind_pointer(), invoke the destructor if the bind index is out of range, like sqlite3_bind_blob() does.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | pointer-with-destructor
Files: files | file ages | folders
SHA3-256: d6684d2a744e6e04b8796c3b5ecb81c6577728b698c1ab5f4a828b2ac114b8a2
User & Date: drh 2017-07-27 16:42:36
Context
2017-07-27
17:45
Add destructor functions for the pointer argument (NB: not the type string) to the sqlite3_bind_pointer() and sqlite3_result_pointer() interfaces. Use this new capability to resolve a pointer leak in the custom geometry function mechanism of the RTREE extension. check-in: 5a2340b8 user: drh tags: branch-3.20
16:42
In sqlite3_bind_pointer(), invoke the destructor if the bind index is out of range, like sqlite3_bind_blob() does. Closed-Leaf check-in: d6684d2a user: drh tags: pointer-with-destructor
15:53
Improved implementation of the destructor on pointer-passing interfaces. check-in: 601ad679 user: drh tags: pointer-with-destructor
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeapi.c.

  1413   1413   ){
  1414   1414     int rc;
  1415   1415     Vdbe *p = (Vdbe*)pStmt;
  1416   1416     rc = vdbeUnbind(p, i);
  1417   1417     if( rc==SQLITE_OK ){
  1418   1418       sqlite3VdbeMemSetPointer(&p->aVar[i-1], pPtr, zPTtype, xDestructor);
  1419   1419       sqlite3_mutex_leave(p->db->mutex);
         1420  +  }else if( xDestructor ){
         1421  +    xDestructor(pPtr);
  1420   1422     }
  1421   1423     return rc;
  1422   1424   }
  1423   1425   int sqlite3_bind_text( 
  1424   1426     sqlite3_stmt *pStmt, 
  1425   1427     int i, 
  1426   1428     const char *zData,