On 08/20/2013 09:08 PM, Ashok Pitambar wrote:
Hi Richard,If list of available buffers (*db->lookaside.pFree*) is NULL and it is assigned to pBuf and if you access pBuf->pNext it will crash. read my comments in below code snippet. There is good chance that sqlite may end up with empty lookaside pool(*db->lookaside.pFree*) list when there were many prepare statements are executed. please read my comments in code: if( db->lookaside.bEnabled ){ if( n>db->lookaside.sz ){ db->lookaside.anStat[1]++; } * //pBuf assigned with list of available buffers * * else if( (pBuf = db->lookaside.pFree)==0 ){* db->lookaside.anStat[2]++; }else{ * //it will crash here and there is no check for NULL here* * db->lookaside.pFree = pBuf->pNext;* db->lookaside.nOut++; db->lookaside.anStat[0]++; if( db->lookaside.nOut>db->lookaside.mxOut ){ db->lookaside.mxOut = db->lookaside.nOut; } return (void*)pBuf;
You're misreading the "else if" condition. If pBuf is set to NULL, the condition will be true and the "db->lookaside.anStat[2]++;" line executed. Not the block below it. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

