if create an sqlite statement that uses the same parameter more than once ie
NSString* updateStmt = @"INSERT INTO search_email(..., subject, ...)"
" SELECT ..., :subject, ...,"
" coalesce((SELECT search_email.threadID "
" FROM search_email "
" WHERE search_email.subject MATCH :subject2 "
" ),"
" :uid"
" )";
int subjectIndex =
sqlite3_bind_parameter_index(searchEmailInsertStmt,":subject");
int subjectIndex2 =
sqlite3_bind_parameter_index(searchEmailInsertStmt,":subject2");
...
sqlite3_bind_text(searchEmailInsertStmt, subjectIndex, [subject UTF8String],
-1, SQLITE_TRANSIENT); // subject
sqlite3_bind_text(searchEmailInsertStmt, subjectIndex2, [subjectCopy
UTF8String], -1, SQLITE_TRANSIENT); // search_email.subject
then it crashes with the following error: malloc: *** error for object
0x9b6350: pointer being freed was not allocated *** set a breakpoint in
malloc_error_break to debug
any idea why?
--
View this message in context:
http://sqlite.1065341.n5.nabble.com/using-the-same-sqlite-parameter-more-than-once-causes-premature-memory-deallocation-tp66687.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users