Hello All,
I am using SQLite 3.0.7.1.
I have written below code can you please explain is there any memory leak ?
char *sql_get_ID_from_extid_userinfo = "SELECT ID FROM User_Info where (extended_id=?)";
sqlite_db_ctx_t * ct = (sqlite_db_ctx_t*)ctx;
int rc=0;
sqlite3_stmt *ppStmt;
rc = sqlite3_prepare_v2(ct->con_db, sql_get_ID_from_extid_userinfo,-1,&ppStmt,NULL);
if(rc != SQLITE_OK)
{
Debug(__func__,"[%d] :Error:Preparing USERINFO EXTID statement. '%s'\n",__LINE__, sqlite3_errmsg(ct->con_db));
sqlite3_finalize(ppStmt);
return DBAPI_DBERROR;
}
sqlite3_bind_blob(ppStmt,1, extid, 64,SQLITE_TRANSIENT);
rc = sqlite3_step(ppStmt);
if (SQLITE_ROW == rc || SQLITE_OK == rc)
{
*ID = sqlite3_column_int(ppStmt, 0);
sqlite3_finalize(ppStmt);
return DBAPI_OK;
}
else
{
sqlite3_finalize(ppStmt);
return DBAPI_DBERROR;
}
I have used sqlite3_finalize() statement to free the memory used by SQL. and i have checked memory usage sqlite3_status(SQLITE_STATUS_MEMORY_USED, ¤tuse, &high, 1); From the statuc command i have check variable currebntuse and in that variable it show some integer value so is there memory leak issue ? or is there any way i can check that memory leak issue in above code ?
Thanks, Neel