Fossil SCM

Extra defenses against running fossil_atexit() more than once.

drh 2019-08-21 16:57 trunk
Commit bc7683e15ab55d0062b140741cf49f3f87b761e326432dcb2881dc5cab1ee4b4
1 file changed +2
+2
--- src/main.c
+++ src/main.c
@@ -328,10 +328,12 @@
328328
/*
329329
** atexit() handler which frees up "some" of the resources
330330
** used by fossil.
331331
*/
332332
static void fossil_atexit(void) {
333
+ static int once = 0;
334
+ if( once++ ) return; /* Ensure that this routine only runs once */
333335
#if USE_SEE
334336
/*
335337
** Zero, unlock, and free the saved database encryption key now.
336338
*/
337339
db_unsave_encryption_key();
338340
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button