/ Check-in [c249d5da]
Login

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

Overview
Comment:Avoid leaking a file descriptor after a malloc failure on unix. (CVS 4518)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c249d5da721b32f6fe409a5b55a5d49a58994fec
User & Date: danielk1977 2007-10-30 17:28:52
Context
2007-11-01
17:38
Add a prototype "group_concat()" aggregate function to func.c. Disabled by default. No documentation nor test cases. No effort to make it efficient. (CVS 4519) check-in: 61987a89 user: drh tags: trunk
2007-10-30
17:28
Avoid leaking a file descriptor after a malloc failure on unix. (CVS 4518) check-in: c249d5da user: danielk1977 tags: trunk
15:38
Remove a debugging assert() that went in by accident with the previous commit. (CVS 4517) check-in: 4ad60bdb user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/os_unix.c.

2264
2265
2266
2267
2268
2269
2270

2271
2272
2273
2274
2275
2276
2277
  fcntl(h, F_SETFD, fcntl(h, F_GETFD, 0) | FD_CLOEXEC);
#endif

  enterMutex();
  rc = findLockInfo(h, &pNew->pLock, &pNew->pOpen);
  leaveMutex();
  if( rc ){

    close(h);
    return SQLITE_NOMEM;
  }

  OSTRACE3("OPEN    %-3d %s\n", h, zFilename);
  pNew->dirfd = -1;
  pNew->h = h;







>







2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
  fcntl(h, F_SETFD, fcntl(h, F_GETFD, 0) | FD_CLOEXEC);
#endif

  enterMutex();
  rc = findLockInfo(h, &pNew->pLock, &pNew->pOpen);
  leaveMutex();
  if( rc ){
    if( dirfd>=0 ) close(dirfd);
    close(h);
    return SQLITE_NOMEM;
  }

  OSTRACE3("OPEN    %-3d %s\n", h, zFilename);
  pNew->dirfd = -1;
  pNew->h = h;