Fossil SCM
Extra defenses against running fossil_atexit() more than once.
Commit
bc7683e15ab55d0062b140741cf49f3f87b761e326432dcb2881dc5cab1ee4b4
Parent
07a5a2118e23760…
1 file changed
+2
+2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -328,10 +328,12 @@ | ||
| 328 | 328 | /* |
| 329 | 329 | ** atexit() handler which frees up "some" of the resources |
| 330 | 330 | ** used by fossil. |
| 331 | 331 | */ |
| 332 | 332 | static void fossil_atexit(void) { |
| 333 | + static int once = 0; | |
| 334 | + if( once++ ) return; /* Ensure that this routine only runs once */ | |
| 333 | 335 | #if USE_SEE |
| 334 | 336 | /* |
| 335 | 337 | ** Zero, unlock, and free the saved database encryption key now. |
| 336 | 338 | */ |
| 337 | 339 | db_unsave_encryption_key(); |
| 338 | 340 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -328,10 +328,12 @@ | |
| 328 | /* |
| 329 | ** atexit() handler which frees up "some" of the resources |
| 330 | ** used by fossil. |
| 331 | */ |
| 332 | static void fossil_atexit(void) { |
| 333 | #if USE_SEE |
| 334 | /* |
| 335 | ** Zero, unlock, and free the saved database encryption key now. |
| 336 | */ |
| 337 | db_unsave_encryption_key(); |
| 338 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -328,10 +328,12 @@ | |
| 328 | /* |
| 329 | ** atexit() handler which frees up "some" of the resources |
| 330 | ** used by fossil. |
| 331 | */ |
| 332 | static void fossil_atexit(void) { |
| 333 | static int once = 0; |
| 334 | if( once++ ) return; /* Ensure that this routine only runs once */ |
| 335 | #if USE_SEE |
| 336 | /* |
| 337 | ** Zero, unlock, and free the saved database encryption key now. |
| 338 | */ |
| 339 | db_unsave_encryption_key(); |
| 340 |