Fossil SCM
Fix a use-after-free when printing the "home directory must be writable" error message.
Commit
aad4b78936f1543ffe2ee38deb8d27d4f77ae76b64e018ebceb24ff7b1c389c4
Parent
85a99733d543b96…
1 file changed
+1
-1
M
src/db.c
+1
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1914,16 +1914,16 @@ | ||
| 1914 | 1914 | int rc; |
| 1915 | 1915 | if( file_isdir(zHome, ExtFILE)==0 ){ |
| 1916 | 1916 | file_mkdir(zHome, ExtFILE, 0); |
| 1917 | 1917 | } |
| 1918 | 1918 | rc = file_access(zHome, W_OK); |
| 1919 | - fossil_free(zHome); | |
| 1920 | 1919 | if( rc ){ |
| 1921 | 1920 | if( isOptional ) return 0; |
| 1922 | 1921 | fossil_fatal("home directory \"%s\" must be writeable", zHome); |
| 1923 | 1922 | } |
| 1924 | 1923 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 1924 | + fossil_free(zHome); | |
| 1925 | 1925 | } |
| 1926 | 1926 | if( file_access(zDbName, W_OK) ){ |
| 1927 | 1927 | if( isOptional ) return 0; |
| 1928 | 1928 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 1929 | 1929 | } |
| 1930 | 1930 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1914,16 +1914,16 @@ | |
| 1914 | int rc; |
| 1915 | if( file_isdir(zHome, ExtFILE)==0 ){ |
| 1916 | file_mkdir(zHome, ExtFILE, 0); |
| 1917 | } |
| 1918 | rc = file_access(zHome, W_OK); |
| 1919 | fossil_free(zHome); |
| 1920 | if( rc ){ |
| 1921 | if( isOptional ) return 0; |
| 1922 | fossil_fatal("home directory \"%s\" must be writeable", zHome); |
| 1923 | } |
| 1924 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 1925 | } |
| 1926 | if( file_access(zDbName, W_OK) ){ |
| 1927 | if( isOptional ) return 0; |
| 1928 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 1929 | } |
| 1930 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1914,16 +1914,16 @@ | |
| 1914 | int rc; |
| 1915 | if( file_isdir(zHome, ExtFILE)==0 ){ |
| 1916 | file_mkdir(zHome, ExtFILE, 0); |
| 1917 | } |
| 1918 | rc = file_access(zHome, W_OK); |
| 1919 | if( rc ){ |
| 1920 | if( isOptional ) return 0; |
| 1921 | fossil_fatal("home directory \"%s\" must be writeable", zHome); |
| 1922 | } |
| 1923 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 1924 | fossil_free(zHome); |
| 1925 | } |
| 1926 | if( file_access(zDbName, W_OK) ){ |
| 1927 | if( isOptional ) return 0; |
| 1928 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 1929 | } |
| 1930 |