Hi Dan,

Yes you are right , I think in my case pBuf has corrupted memory and while
trying to access this it
is crashing.

Regards,
Ashok


On Tue, Aug 20, 2013 at 7:47 PM, Dan Kennedy <danielk1...@gmail.com> wrote:

> 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
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<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