/ Check-in [37e60d21]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a memory leak of the temporary read buffer.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | winPreCache
Files: files | file ages | folders
SHA1: 37e60d211f70d12eda6d8b63da5e5e307e9d1748
User & Date: mistachkin 2014-05-08 22:08:22
Context
2014-05-08
22:15
Fix typos in logging code. check-in: dc7f84df user: mistachkin tags: winPreCache
22:08
Fix a memory leak of the temporary read buffer. check-in: 37e60d21 user: mistachkin tags: winPreCache
22:05
Update comments and only include the thread routine when required. check-in: a60c545f user: mistachkin tags: winPreCache
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

  3260   3260       osCloseHandle(dupHandle);
  3261   3261       OSTRACE(("PRE-CACHE file=%p, rc=SQLITE_IOERR_NOMEM\n", dupHandle));
  3262   3262       return SQLITE_IOERR_NOMEM;
  3263   3263     }
  3264   3264     while( 1 ){
  3265   3265       if( !osReadFile(dupHandle, pBuf, dwAmt, &nRead, 0) ){
  3266   3266         pFile->lastErrno = osGetLastError();
         3267  +      sqlite3_free(pBuf);
  3267   3268         osCloseHandle(dupHandle);
  3268   3269         OSTRACE(("PRE-CACHE file=%p, rc=SQLITE_IOERR_READ\n", dupHandle));
  3269   3270         return winLogError(SQLITE_IOERR_READ, pFile->lastErrno,
  3270   3271                            "winPreCacheThread3", pFile->zPath);
  3271   3272       }
  3272   3273       if( nRead<dwAmt ){
         3274  +      sqlite3_free(pBuf);
  3273   3275         osCloseHandle(dupHandle);
  3274   3276         OSTRACE(("PRE-CACHE file=%p, rc=SQLITE_IOERR_SHORT_READ\n", dupHandle));
  3275   3277         return winLogError(SQLITE_IOERR_SHORT_READ, pFile->lastErrno,
  3276   3278                            "winPreCacheThread4", pFile->zPath);
  3277   3279       }
  3278   3280       dwSize -= dwAmt;
  3279   3281       if( dwSize==0 ){
  3280   3282         break;
  3281   3283       }
  3282   3284     }
         3285  +  sqlite3_free(pBuf);
  3283   3286     osCloseHandle(dupHandle);
  3284   3287     return SQLITE_OK;
  3285   3288   }
  3286   3289   #endif
  3287   3290   
  3288   3291   /* 
  3289   3292   ** Windows will only let you create file view mappings