SQLite Archiver

Check-in [c3c0cdcaca]
Login

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

Overview
Comment:Add a missing fclose() to fix a file-descriptor leak.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c3c0cdcacae0b189164d6c0a4a90d8e8a06fb76f
User & Date: drh 2014-03-14 00:22:50
Context
2014-03-14
00:30
Recurse into directories whose names begin with "." as long as they are not named exactly "." or "..". Correctly handle zero-length files. check-in: 2bf2fef18d user: drh tags: trunk
00:22
Add a missing fclose() to fix a file-descriptor leak. check-in: c3c0cdcaca user: drh tags: trunk
00:19
Add the -v (verbose) command-line option. check-in: b7c6557186 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to sar.c.

142
143
144
145
146
147
148

149
150
151
152
153
154
155
  nIn = ftell(in);
  rewind(in);
  zIn = sqlite3_malloc( nIn+1 );
  if( zIn==0 ) errorMsg("cannot malloc for %d bytes\n", nIn+1);
  if( fread(zIn, nIn, 1, in)!=1 ){
    errorMsg("unable to read %d bytes of file %s\n", nIn, zFilename);
  }

  nCompr = 13 + nIn + (nIn+999)/1000;
  zCompr = sqlite3_malloc( nCompr+1 );
  if( zCompr==0 ) errorMsg("cannot malloc for %d bytes\n", nCompr+1);
  rc = compress(zCompr, &nCompr, zIn, nIn);
  if( rc!=Z_OK ) errorMsg("Cannot compress %s\n", zFilename);
  sqlite3_free(zIn);
  *pSizeOrig = nIn;







>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
  nIn = ftell(in);
  rewind(in);
  zIn = sqlite3_malloc( nIn+1 );
  if( zIn==0 ) errorMsg("cannot malloc for %d bytes\n", nIn+1);
  if( fread(zIn, nIn, 1, in)!=1 ){
    errorMsg("unable to read %d bytes of file %s\n", nIn, zFilename);
  }
  fclose(in);
  nCompr = 13 + nIn + (nIn+999)/1000;
  zCompr = sqlite3_malloc( nCompr+1 );
  if( zCompr==0 ) errorMsg("cannot malloc for %d bytes\n", nCompr+1);
  rc = compress(zCompr, &nCompr, zIn, nIn);
  if( rc!=Z_OK ) errorMsg("Cannot compress %s\n", zFilename);
  sqlite3_free(zIn);
  *pSizeOrig = nIn;