The sqlite3_deserialize comment and behavior do not coincide
There is the following comment in sqlite3.h:
** 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.
But this is not true - the only usage of pData is on the line:
p->aData = pData;
Just before the successful exit, so the memory block is never freed on the function fail