Thanks Dan!
I think I shouldn't call finalizeStmHandle(pReadStmt); before closeReportDB()

Here is the codes:
........................
finalizeStmHandle(pReadStmt); 
 closeReportDB() ; (this function call closeDb().

Part of Stack trace:
#0sqlite3_finalize (pStmt=0x28) at ../src/vdbeapi.c:204
#1  0xb74484b3 in MonDb::closeDb (this=0xb6022e5c) at 
/builds/BLD_6.0B2.10/SRC/phoenix/src/wx/MonAgt/util/MonDb.cpp:80

Here is the functions finalizeStmHandle() and closeReportDB()
void MonDb::finalizeStmHandle(sqlite3_stmt  *&pStmt)
{
 if (pStmt) {
   sqlite3_finalize(pStmt);
   pStmt = NULL;
 }
}
void closeReportDB() { closeDb(); };

bool MonDb::closeDb()
{
 int sqlSt;
 const char* errMsg;
// sqlite3_stmt *pStmt1;
 if (pDb != NULL) {
  //while( (pStmt = sqlite3_next_stmt(pDb, 0))!=0 ){
   if (pStmt) {
    sqlite3_finalize(pStmt);
    pStmt= NULL;
   }
  //}
  sqlSt = sqlite3_close(pDb);
  if(sqlSt != SQLITE_OK){ 
   errMsg = sqlite3_errmsg(pDb);
   WXLOGE(LOG_ALL_OPT_OFF, WX_MODULE_ID_MONSTATS, 
WX_SUBMOD_ID_MONSTATS_COLLECTOR,
              "%s: Error in closing Monitoring database name: %s. Sqlite error 
message: %s ",__FUNCTION__, name, errMsg);
#ifndef _WINDOWS
   sqlite3_free((char*) errMsg);
#endif
  }
  pDb=NULL;
 }
 return true;
}




________________________________
From: Dan <danielk1...@gmail.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Friday, February 13, 2009 9:14:20 AM
Subject: Re: [sqlite] sqlite3_finalize (pStmt=0x28) at ../src/vdbeapi.c:204


On Feb 13, 2009, at 11:24 PM, Joanne Pham wrote:

> Thanks for the respond!
> So how can we find out the pStmt is valid or not. I did check to see  
> if it is not NULL before passing this sqlite3_finalize (pStmt=0x28).  
> To find out the valid handle is touch because the problem couldn't  
> duplicate all the time.
> Your response is greatly appreciated.
> JP

The value 0x28 is almost certainly not a valid address.

Sounds like an uninitialized variable. If you're using linux,
run your program under valgrind and it will tell you the problem.




> ________________________________
> From: Dan <danielk1...@gmail.com>
> To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
> Sent: Thursday, February 12, 2009 9:03:12 PM
> Subject: Re: [sqlite] sqlite3_finalize (pStmt=0x28) at ../src/ 
> vdbeapi.c:204
>
>
> On Feb 13, 2009, at 11:49 AM, Joanne Pham wrote:
>
>> Hi All,
>> We have an application is used SQLite 3.5.9 and our program is
>> crashed on
>> "sqlite3_finalize (pStmt=0x28) at ../src/vdbeapi.c:204" and I don't
>> know why it crashed on this line.
>> Do you have any information about why it is crashed on
>> sqlite3_finalize at 204 vdbeapi.
>
> The argument passed to sqlite3_finalize() is invalid. Where is
> it being called from?
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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



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

Reply via email to