]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a memory leak that could follow an OOM error in the new code on this branch.
authordan <Dan Kennedy>
Fri, 12 Jun 2026 17:16:12 +0000 (17:16 +0000)
committerdan <Dan Kennedy>
Fri, 12 Jun 2026 17:16:12 +0000 (17:16 +0000)
FossilOrigin-Name: d4774a898730d9ef7564bba0a8531748e31e6517ab29564c2f5a0196c1584451

manifest
manifest.uuid
src/pager.c

index b112d0c8c3a49360c3d296bf7683882a1b5c95c4..7cbd0286fbc2e5b59cd388c5f23e6065536d75d4 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C When\sreading\sa\ssuper-journal\sname\sfrom\sa\sjournal\sfile,\sallocate\sa\snew\sbuffer\srather\sthan\susing\sPager.pTmpSpace.\sThis\sprevents\sa\sbuffer\soverrun\sthat\scould\soccur\swhen\susing\sa\sVFS\swith\sa\slarge\ssqlite3_vfs.mxPathname\svalue\swith\sa\sdatabase\swith\sa\ssmall\spage\ssize.
-D 2026-06-10T20:10:19.569
+C Fix\sa\smemory\sleak\sthat\scould\sfollow\san\sOOM\serror\sin\sthe\snew\scode\son\sthis\sbranch.
+D 2026-06-12T17:16:12.267
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -726,7 +726,7 @@ F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae
 F src/os_unix.c 83759942d1ea8d59daed50901c123016f845fada74caf3496b8a2537c9a08838
 F src/os_win.c 8df4b34ec6a08616a7ac33164999524ef773fa359d39ae9ae0e7e1ae4f167440
 F src/os_win.h c06ccc3a090cf54202ea58981c298817f3309d4c9e4d52ad0a02927346493721
-F src/pager.c cb691a81605f211d88d945e8d0ead84cf654ac7b19245cd65b3e5e69ea87e024
+F src/pager.c b7635f6058437891b0c580955686dfe8c3e212c49f0a68fc9230a2ee1ecb444b
 F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
 F src/parse.y d5a3c5b0277a441c38b35071c05e2b61ff5fc918a63309c809f4b6706179c320
 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
@@ -2209,11 +2209,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P fc6442ee54795fbeb746539193716238aa653d80170523bc327ae3ce0d945ebf
-R d78d4f2bafad585e32d486b41a8f1c32
-T *branch * super-journal-malloc
-T *sym-super-journal-malloc *
-T -sym-trunk *
+P 37aa82a50a0a1c5edb4c4f2de1cb00fa009ebbfeb420df3de72231c5d883518a
+R 772da6d981cb3b84c26401db02a8f3e5
 U dan
-Z 2d91bb66833487307406c342f82ea2df
+Z 42d4e0e9d2c0d710032a00cb77f8e03f
 # Remove this line to create a well-formed Fossil manifest.
index 72d6a06437ffdac74c1ebcea4cdff2e5fcdc79f6..8bd35fe9c42ef00cf72466cca183ad585b957d56 100644 (file)
@@ -1 +1 @@
-37aa82a50a0a1c5edb4c4f2de1cb00fa009ebbfeb420df3de72231c5d883518a
+d4774a898730d9ef7564bba0a8531748e31e6517ab29564c2f5a0196c1584451
index 6f5964acc3bc53630158580173eda592350d81f2..1f8cd855067aae10c9d040d3bf2bca0aa2e86649 100644 (file)
@@ -1271,50 +1271,6 @@ static void checkPage(PgHdr *pPg){
 #define CHECK_PAGE(x)
 #endif  /* SQLITE_CHECK_PAGES */
 
-#if 0
-static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u64 nSuper){
-  int rc;                    /* Return code */
-  u32 len;                   /* Length in bytes of super-journal name */
-  i64 szJ;                   /* Total size in bytes of journal file pJrnl */
-  u32 cksum;                 /* MJ checksum value read from journal */
-  u32 u;                     /* Unsigned loop counter */
-  unsigned char aMagic[8];   /* A buffer to hold the magic header */
-  zSuper[0] = '\0';
-
-  if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ))
-   || szJ<16
-   || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len))
-   || len>=nSuper
-   || len>szJ-16
-   || len==0
-   || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum))
-   || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8))
-   || memcmp(aMagic, aJournalMagic, 8)
-   || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zSuper, len, szJ-16-len))
-  ){
-    return rc;
-  }
-
-  /* See if the checksum matches the super-journal name */
-  for(u=0; u<len; u++){
-    cksum -= zSuper[u];
-  }
-  if( cksum ){
-    /* If the checksum doesn't add up, then one or more of the disk sectors
-    ** containing the super-journal filename is corrupted. This means
-    ** definitely roll back, so just return SQLITE_OK and report a (nul)
-    ** super-journal filename.
-    */
-    len = 0;
-  }
-  zSuper[len] = '\0';
-  zSuper[len+1] = '\0';
-  
-  return SQLITE_OK;
-}
-#endif
-
-
 /*
 ** Free a buffer allocated by the readSuperJournal() function.
 */
@@ -1377,14 +1333,14 @@ static int readSuperJournal(sqlite3_file *pJrnl, u64 nSuper, char **pzSuper){
       for(u=0; u<len; u++){
         cksum -= zOut[u];
       }
-      if( cksum ){
-        /* If the checksum doesn't add up, then one or more of the disk sectors
-        ** containing the super-journal filename is corrupted. This means
-        ** definitely roll back, so just return SQLITE_OK and report a (nul)
-        ** super-journal filename.  */
-        freeSuperJournal(zOut);
-        zOut = 0;
-      }
+    }
+    if( rc!=SQLITE_OK || cksum ){
+      /* If the checksum doesn't add up, then one or more of the disk sectors
+      ** containing the super-journal filename is corrupted. This means
+      ** definitely roll back, so just return SQLITE_OK and report a (nul)
+      ** super-journal filename.  */
+      freeSuperJournal(zOut);
+      zOut = 0;
     }
   }