"Ben Combee" <[EMAIL PROTECTED]> wrote:
> This is something the Coverity caught when run locally on the SQLite
> 3.3.17 source, but it seems to still be there in the CVS version:
>
> In select.c's sqlite3ResultSetOfSelect(), zName is allocated using a
> malloc-style function at the top of the routine. Later, there's code
> to guarantee a unique name:
>
> /* Make sure the column name is unique. If the name is not unique,
> ** append a integer to the name so that it becomes unique.
> */
> for(j=cnt=0; j<i; j++){
> if( sqlite3StrICmp(aCol[j].zName, zName)==0 ){
> zName[nName] = 0;
> zName = sqlite3MPrintf("%z:%d", zName, ++cnt);
> j = -1;
> if( zName==0 ) break;
> }
>
> Won't this code leak the memory to which zName points during the
> assignment from the call to sqlite3MPrintf?
>
The %z calls sqliteFree() for you automatically.
--
D. Richard Hipp <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------