SQLite Forum

The sqlite3_deserialize comment and behavior do not coincide
Login

The sqlite3_deserialize comment and behavior do not coincide

(1) By holybrake on 2020-10-17 20:36:04 [link]

Hello!

There is the following comment in sqlite3.h:
<code>
** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the 
** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
** [sqlite3_free()] is invoked on argument P prior to returning.
<code>
But this is not true - the only usage of pData is on the line:
<code>
    p->aData = pData;
<code>
Just before the successful exit, so the memory block is never freed on the function fail

(2) By Richard Hipp (drh) on 2020-10-17 22:50:10 in reply to 1

Thanks for the report.  Should be fixed by [check-in d6fac8a1d3efeb2c][1].

[1]: src:/timeline?c=d6fac8a1d3efeb2c