Hi, I've a reproduceable error in my code, running a simple SQL question gives me a segment fault. Running the program i gdb and doing backtrace gives me this:
(gdb) backtrace #0 malloc_consolidate (av=av at entry=0x7ffff76be620 <main_arena>) at malloc.c:4149 #1 0x00007ffff7394ee8 in _int_malloc (av=0x7ffff76be620 <main_arena>, bytes=3224) at malloc.c:3423 #2 0x00007ffff7397070 in __GI___libc_malloc (bytes=3224) at malloc.c:2891 #3 0x00007ffff7b53e77 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #4 0x00007ffff7b2b12f in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #5 0x00007ffff7b86cee in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #6 0x00007ffff7b87442 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #7 0x00007ffff7b877b7 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #8 0x00007ffff7b87a66 in sqlite3_prepare_v2 () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #9 0x00007ffff7b87b21 in sqlite3_exec () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #10 0x00000000004079a1 in list_event (v=0x622d20, account_id=41, nbr_of_results=10) at event.c:223 #11 0x000000000040b5a8 in load_account (account_id=41, v=0x622d20) at account.c:603 #12 0x0000000000401baa in tload_account () at t/test.c:201 #13 0x0000000000402017 in taccount () at t/test.c:271 #14 0x000000000040369e in all_tests () at t/test.c:668 #15 0x000000000040374d in main (argc=1, argv=0x7fffffffe4a8) at t/test.c:683 The SQL in question is: SELECT id, date, text FROM events WHERE account_id=41 ORDER BY date DESC LIMIT 10 and it works fine running in the sqlite3 program (the query program that comes with sqlite3). Now the code above in list_event() has been working before but broke after a minor change that shouldn't effect sqlite3. I might have done that, however I don't expect this behaviour from sqlite3. The code that gives that error could be seen here: 221 if ( v == NULL) 222 flog("view is NULL\n\n"); 223 rc = sqlite3_exec(db, "SELECT id, date, text FROM events WHERE account_id=1 ORDER BY date DESC LIMIT 10" , NULL, NULL, &zErrMsg); 224 flog("query done\n"); 225 226 if (rc != SQLITE_OK) { 227 flog("ERROR: Could not list events, SQL error: %s\n\n%s", zErrMsg, q); 228 sqlite3_free(zErrMsg); 229 toret = -1; 230 } The callback function is never called. Despite any errors in my code (which I'm sure there's), why does sqlite3 crash this way? -- Fredrik Gustafsson phone: +46 733-608274 e-mail: iveqy at iveqy.com website: http://www.iveqy.com