/ Check-in [b29cda03]
Login

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

Overview
Comment:Fix a resource leak in os_unix.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental-mmap
Files: files | file ages | folders
SHA1: b29cda03fe4e8d8f5b5acbbea2d69f284a2bdf23
User & Date: dan 2013-04-02 20:55:01
Context
2013-04-03
00:42
Fix the unix driver to check defined(_BSD_SOURCE) rather than just the plain _BSD_SOURCE macro. This fixes the build for OpenBSD. check-in: 1dd42ef4 user: drh tags: experimental-mmap
2013-04-02
20:55
Fix a resource leak in os_unix.c. check-in: b29cda03 user: dan tags: experimental-mmap
20:29
Adjustments to mmap1.test so that it works better on windows. It still gets some answers wrong, but it no longer crashes. check-in: ee8d3cee user: drh tags: experimental-mmap
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

  4597   4597           pNew = 0;
  4598   4598         }else{
  4599   4599           pNew = pOrig;
  4600   4600         }
  4601   4601       }
  4602   4602   #endif
  4603   4603   
  4604         -    /* The attempt to extend the existing mapping failed. Free the existing
  4605         -    ** mapping and set pNew to NULL so that the code below will create a
  4606         -    ** new mapping from scratch.  */
  4607         -    if( pNew==MAP_FAILED ){
         4604  +    /* The attempt to extend the existing mapping failed. Free it. */
         4605  +    if( pNew==MAP_FAILED || pNew==0 ){
  4608   4606         osMunmap(pOrig, nReuse);
  4609   4607       }
  4610   4608     }
  4611   4609   
  4612   4610     /* If pNew is still NULL, try to create an entirely new mapping. */
  4613   4611     if( pNew==0 ){
  4614   4612       pNew = osMmap(0, nNew, flags, MAP_SHARED, h, 0);