** This function is a no-op if the recover handle passed as the first ** argument already contains an error (if p->errCode!=SQLITE_OK). ** ** Otherwise, an attempt is made to allocate, zero and return a buffer nByte ** bytes in size. If successful, a pointer to the new buffer is returned. Or, ** if an OOM error occurs, NULL is returned and the handle error code ** (p->errCode) set to SQLITE_NOME
| 13792 | ** (p->errCode) set to SQLITE_NOMEM. |
| 13793 | */ |
| 13794 | static void *recoverMalloc(sqlite3_recover *p, i64 nByte){ |
| 13795 | void *pRet = 0; |
| 13796 | assert( nByte>0 ); |
| 13797 | if( p->errCode==SQLITE_OK ){ |
| 13798 | pRet = sqlite3_malloc64(nByte); |
| 13799 | if( pRet ){ |
| 13800 | memset(pRet, 0, nByte); |
| 13801 | }else{ |
| 13802 | p->errCode = SQLITE_NOMEM; |
| 13803 | } |
| 13804 | } |
| 13805 | return pRet; |
| 13806 | } |
| 13807 | |
| 13808 | /* |
| 13809 | ** Set the error code and error message for the recover handle passed as |
no test coverage detected