SQLite

Check-in [d6684d2a74]
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
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.805
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: 5a2340b81f 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: d6684d2a74 user: drh tags: pointer-with-destructor)
15:53
Improved implementation of the destructor on pointer-passing interfaces. (check-in: 601ad67959 user: drh tags: pointer-with-destructor)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbeapi.c.
1413
1414
1415
1416
1417
1418
1419


1420
1421
1422
1423
1424
1425
1426
){
  int rc;
  Vdbe *p = (Vdbe*)pStmt;
  rc = vdbeUnbind(p, i);
  if( rc==SQLITE_OK ){
    sqlite3VdbeMemSetPointer(&p->aVar[i-1], pPtr, zPTtype, xDestructor);
    sqlite3_mutex_leave(p->db->mutex);


  }
  return rc;
}
int sqlite3_bind_text( 
  sqlite3_stmt *pStmt, 
  int i, 
  const char *zData, 







>
>







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