On 12/2/2016 8:39 PM, Igor Tandetnik wrote:
On 12/2/2016 6:56 PM, Igor Korot wrote:
        res = sqlite3_bind_text( stmt, 1,
sqlite_pimpl->m_myconv.to_bytes( tableName.c_str() ).c_str(), -1,
SQLITE_STATIC );

SQLITE_STATIC tells SQLite that the string will outlive the statement
handle. But in fact, you are passing a temporary buffer, deallocated at
the end of the statement. Your program exhibits undefined behavior.

Upon re-reading, that sounds ambiguous. What I meant was, the temporary string is deallocated at the end of the C++ statement in which it was created - in other words, at the nearest semicolon. It gets pulled right from under a live SQLite statement.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to