*** 145,151 **** int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); The method creates a new cursor used for reading information out ! of a virtual table. The cursor is returned in *ppCursor. The cursor is not immediately usable. It must first be positioned using xFilter. Then elements of a row of the --- 145,153 ---- int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); The method creates a new cursor used for reading information out ! of a virtual table. You should allocate the memory for the ! sqlite3_vtab_cursor (or a subclass) and return it in *ppCursor. ! Do not allocate a cursor if you do not return SQLITE_OK. The cursor is not immediately usable. It must first be positioned using xFilter. Then elements of a row of the *************** *** 161,166 **** --- 163,172 ---- This method closes a cursor previously opened by xOpen. The SQLite core will always call xClose once for each cursor opened using xOpen. + + You should free the cursor which you allocated in xOpen, + even if you will return an error. The routine will not be called + again if you return an error. ---- *xEof*